/source/Plug-in/fck/editor/filemanager/connectors/cfm/cf_upload.cfm

http://prosporous.googlecode.com/ · ColdFusion · 68 lines · 40 code · 4 blank · 24 comment · 0 complexity · 92ee8c685455e3fadc351fb01c3b922f MD5 · raw file

  1. <cfsetting enablecfoutputonly="yes" showdebugoutput="no">
  2. <!---
  3. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4. * Copyright (C) 2003-2007 Frederico Caldeira Knabben
  5. *
  6. * == BEGIN LICENSE ==
  7. *
  8. * Licensed under the terms of any of the following licenses at your
  9. * choice:
  10. *
  11. * - GNU General Public License Version 2 or later (the "GPL")
  12. * http://www.gnu.org/licenses/gpl.html
  13. *
  14. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15. * http://www.gnu.org/licenses/lgpl.html
  16. *
  17. * - Mozilla Public License Version 1.1 or later (the "MPL")
  18. * http://www.mozilla.org/MPL/MPL-1.1.html
  19. *
  20. * == END LICENSE ==
  21. *
  22. * File Browser connector for ColdFusion (MX 6.0 and above).
  23. * (based on the original CF connector by Hendrik Kramer - hk@lwd.de)
  24. --->
  25. <cfparam name="url.type" default="File">
  26. <cfparam name="url.currentFolder" default="/">
  27. <!--- note: no serverPath url parameter - see config.cfm if you need to set the serverPath manually --->
  28. <cfinclude template="config.cfm">
  29. <cfinclude template="cf_util.cfm">
  30. <cfinclude template="cf_io.cfm">
  31. <cfinclude template="cf_commands.cfm">
  32. <cfset REQUEST.Config = Config>
  33. <cfif find( "/", getBaseTemplatePath() ) >
  34. <cfset REQUEST.Fs = "/">
  35. <cfelse>
  36. <cfset REQUEST.Fs = "\">
  37. </cfif>
  38. <cfif not Config.Enabled>
  39. <cfset SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/cfm/config.cfm" file' )>
  40. </cfif>
  41. <cfset sCommand = 'QuickUpload'>
  42. <cfset sType = "File">
  43. <cfif isDefined( "URL.Type" )>
  44. <cfset sType = URL.Type>
  45. </cfif>
  46. <cfset sCurrentFolder = GetCurrentFolder()>
  47. <!--- Is enabled the upload? --->
  48. <cfif not IsAllowedCommand( sCommand )>
  49. <cfset SendUploadResults( "1", "", "", "The """ & sCommand & """ command isn't allowed" )>
  50. </cfif>
  51. <!--- Check if it is an allowed type. --->
  52. <cfif not IsAllowedType( sType )>
  53. <cfset SendUploadResults( "1", "", "", "Invalid type specified" ) >
  54. </cfif>
  55. <cfset FileUpload( sType, sCurrentFolder, sCommand )>