iamkillyou
Programmer
I'm writing an image upload script, and I'm trying to make it as secure as possible, but I have run into an issue with very long file names.
I believe I have tried everything, but I cannot stop cffile from storing a filename that is too long onto my server.
I have cfdumped all of the variables I can think of, but nothing gives me a clue as to what the file name is going to be before cffile stores it (which is too late as I can not delete these files via ftp).
I have tried these cfdumps
<cfdump var="#form#"><BR>
<cfdump var="#cgi#"><BR>
<cfdump var="#client#"><BR>
<cfdump var="#uploadFile#"><BR>
The only one that comes close is attemptedserverfilename but this is after a cffile.
anyway here is the file name -- I know it seems excessive but I am trying to make this as nuke proof as possible:
4444444444433333322222222222222222222222222222222222222222
2222222222222222222222222222222222222222222222222222222222
2222222222222222222222222222222222222222222222222222222222
222222222222222222222222222221104.jpg
This little code snippet seems to be the only place I can get a handle on it (which again is too late):
I was hoping that the temporary server file name was going to be the answer but its formatted like this:
C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\
Does anyone have an ideas?
I believe I have tried everything, but I cannot stop cffile from storing a filename that is too long onto my server.
I have cfdumped all of the variables I can think of, but nothing gives me a clue as to what the file name is going to be before cffile stores it (which is too late as I can not delete these files via ftp).
I have tried these cfdumps
<cfdump var="#form#"><BR>
<cfdump var="#cgi#"><BR>
<cfdump var="#client#"><BR>
<cfdump var="#uploadFile#"><BR>
The only one that comes close is attemptedserverfilename but this is after a cffile.
anyway here is the file name -- I know it seems excessive but I am trying to make this as nuke proof as possible:
4444444444433333322222222222222222222222222222222222222222
2222222222222222222222222222222222222222222222222222222222
2222222222222222222222222222222222222222222222222222222222
222222222222222222222222222221104.jpg
This little code snippet seems to be the only place I can get a handle on it (which again is too late):
Code:
<cfset uploadPath = GetDirectoryFromPath(GetTemplatePath()) & "uploads\">
<cfset request.AcceptImage="image/gif,image/jpg,image/jpeg,image/pjpeg,image/x-png">
<cffile action="upload" fileField="UploadFile" destination="#uploadPath#" nameConflict="MakeUnique" accept="#request.AcceptImage#">
<cfif Len(File.ClientFile) GT 50>
Whoa!!! file name is to looooooooooooooooooooooooong!!!!!<br>
<cfoutput><cfdump var="#cffile#"></cfoutput>
<cfabort>
</cfif>
I was hoping that the temporary server file name was going to be the answer but its formatted like this:
C:\CFusionMX\runtime\servers\default\SERVER-INF\temp\
Does anyone have an ideas?