Jump to content

cffileupload problems


skaterdav85

Recommended Posts

I am having problems getting the cffileupload tag to work within the fusebox framework. I keep getting the status code 500, and the image does not get uploaded. Anyone have any guesses as to why it doesn't work? Here is the code in my view file:

<cffileupload url="index.cfm?fuseaction=app.uploadImagesProcess" />

and here is the code that processes the upload in the resulting fuseaction called uploadImagesProcess:

<cfset uploadFolderPath = "C:\ColdFusion9\wwwroot\WebApp1\uploads" /><cffile action="uploadall" destination="#uploadFolderPath#" nameconflict="makeunique" />

Link to comment
Share on other sites

yup, im using CF9. i tested my code in a folder that wasn't being affected by fusebox, so it was a simple form page called test.cfm and a process page called process.cfm and it worked fine. so my guess is that it has to do with the fusebox framework, but i have no idea what is going on. do you have any ideas?

Link to comment
Share on other sites

I can't say precisely what might be the problem. But, if you're successful outside of the frame work, then I would look at the data structure. For instance, the file upload in 9 might store the file names in an array, where it was traditionally a string. This could be throwing the frame work off.My guess is that fusebox is not programmed to handle the array that the new uploadall function presents. So you might have to find that and or build your own little loop that parses the array and processes them one by one.

Link to comment
Share on other sites

hmm ok. well i decided to put the processing page outside the fusebox and it works partially.Now I'm having trouble using cffile right before I create a directory. I am using the cffileupload tag and my url attribute is a cfm that has the following code. Basically the code below creates a new directory and uploads all the images to that directory. However, it fails on the 2nd upload and i get a 500 error in the cffileupload flash object. However, if I hardcode the directory path, all the images upload fine. Do you know why I am having this problem?

<!--- User will upload all the images to a temp directory based on date and time ---><cfset uploadFolderPath = "C:\ColdFusion9\wwwroot\MyApplication\uploads\" /><cfset date=DateFormat(Now(),'mm-dd-yyyy_') /><cfset time=TimeFormat(Now(),'hh-mm-ss') /><cfset newFolderName = "upload_" & date & time /><cfset newFolder = uploadFolderPath & newFolderName /><cfdirectory action = "create" directory="#newFolder#" /><cffile action="uploadall" destination="#newFolder#" nameconflict="makeunique" />

EDIT: problem fixed. I needed to check if the directory exists before creating it since the url path is called for each file being uploaded.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...