This content has been marked as final. Show 4 replies
> The value of this variable always comes up as a temporary file name with a .tmp extention.
Uploaded files are sent to a temporary directory and assigned a .tmp file extension. You must use cffile action="upload" to finish the upload (for lack of a better description). The file is already saved on the server, the call to cffile just moves it to a different directory and restores the correct file extension.
> The CFIMAGE fails every time because it is not recognizing the image file due to the .tmp .
> Any suggestions anyone????
1. Use cffile action=upload first
2. Use the ImageNew() function to read in the file
Great, thanks. I was able to get the file uploaded fine, but am now having issues with the ImageNew(). I'm getting this error:
The ImageNew(uploadedFile,350,263) image format is not supported on this operating system.
My code is below. I want the image sized at 350x263.
Thanks for your help!
> I was able to get the file uploaded fine, but am now having issues with the ImageNew(). I'm getting this error:
Sorry, my response was unclear. I meant either use option 1 _or_ option 2. For whatever reason, ImageNew understands it is an image file, even though it has a .tmp file extension (unlike cfimage).
But since you are using option 1, just replace the "ImageNew(uploadedFile,350,263)" portion with the full path to your image file (ie c:\myimages\someImage.jpg). Your "result" variable will contain the file details, like the serverDirectory and file name. Use those values to construct the path to the file. Check the documentation to see all of the available file details:
Something like this should read in the image. It is not tested. So watch out for typos and verify it actually _does_ produce a valid file path ;-)
<cfset pathToImage = uploadedFile.serverDirectory &"\"& uploadedFile.serverFile>
debug pathToImage = #pathToImage#<br>
does the file exist? #FileExists(pathToImage)#
Awesome! Worked great -- thanks for the help!!