House of Fusion
Home of the ColdFusion Community

Search cf-talk

December 02, 2008

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31       

Search over 2,500 ColdFusion resources here  >>>      
Home /  Groups /  ColdFusion Talk (CF-Talk)

cffile and security

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Good Morning,
Mark Fuqua
02/28/08 11:19 A
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Mark Fuqua
02/28/2008 11:19 AM

Good Morning, I have been working with cffile for the first time and in the process, read several places that you should upload files to a temp location outside your webroot for security reasons.  My original problem was with trying to eliminate spaces from file names...so now this is the process I'm using...upload to a temp file, remove spaces and replace with _ then move the file (code below) My question is, why do I have to go to a temp file first and is this secure in it's final version/location? Also, how do I deal with naming conflicts...does move allow for the same options as upload...rename, overwrite ect.?  It doesn't seem to allow for a result struc. <!---Query for job folder name---> <cfquery name="jobfolder" datasource="#Application.dbDSN#"> select jobfoldername from jobs where jobId = #session.jobId# </cfquery>   <cfoutput>     <cffile action = "upload"     fileField = "FileToUpload"     destination = "c:/temp"     accept = "image/pjpeg, image/jpg, application/pdf"     nameConflict = "MakeUnique"      result="result">   <cfdump var="#result#">     <cfset NoSpaceServerFileName = reReplace(Result.ServerFileName, "\s+","_", "all")>     <cffile action="rename" source="c:\temp\#Result.serverFileName#.pdf" destination="C:\temp\#NoSpaceServerFileName#.pdf">     <cffile action="move" source="C:\temp\#NoSpaceServerFileName#.pdf" destination="C:\cfusionmx7\wwwroot\pyramidhomeworks\JobAdmin\JobFiles\#jobFo lder.jobFolderName#\#NoSpaceServerFileName#.pdf" result="moveresult">     <br /><cfdump var="#jobFolder#">     </cfoutput>


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists