Copy link to clipboard
Copied
I'm working on building my own photo galllery now that CF has provided this nifty multi-file upload box. The problem is, I can't seem to get it to do what I want.
My idea for the album is to upload everything to a working folder on my website, then have a script resize them (making thumbnails and main images) before moving them to where they'll actually go. But right now, I can't get anything to "upload". Upload is in quotes, because right now, this is all local to my PC. I'm running CF10/Apache2.2.22/MySQL 5.5.28/Ubuntu 12.10.
Right now, here's what I have on my upload.cfm page:
<cfset session.storage = replace(createUUID(), "-","_","all")>
<cffileupload width="640" extensionfilter="jpg,jpeg,png" url="photomanage.cfm?#urlEncodedFormat(session.urltoken)#" name="photos" />
(The UUID stuff is from Ray Camden's tutorial).
And here's what's in photomanage.cfm:
<cffile action="uploadAll" destination="/var/www/manage/upload" nameconflict="makeunique">
Knowing me, there's probably something obvious that I'm doing wrong, but if I knew what that was, I wouldn't be bugging you guys.
If I can get it to upload files, my next step will be to associate the uploads with a particular album, but if I can't do that on upload, I can always associate them in the next step, so no biggie.
Does ColdFusion have write permissions to the /var/www folder?
Copy link to clipboard
Copied
Does ColdFusion have write permissions to the /var/www folder?
Copy link to clipboard
Copied
Yes it does, BUT it DIDN'T have permission to /var/www/upload/ !!! Stupid me for assuming that new folders I create in a directory assume the permissions of the parent directory.
Thanks Tim.
Copy link to clipboard
Copied
No problem Paul.. It is always the little things that get us!
Copy link to clipboard
Copied
I'm afraid I'm back to having problems with this again.
It all worked perfectly on my CF10 local install, but once on the server (CF9 shared hosting) I'm getting 401 errors when I try to upload. The directory permissions should be fine, as I've tried everything up to (and including) 777.
I've also tried fiddling with the createUUID() thing without any luck, and last night I abandoned <cffileupload> and tried the HTML5 multi-upload box, but I can't seem to get a processing page to see what I'm uploading from that.
So I'm sort of stuck doing the FTP thing. Any ideas?
Copy link to clipboard
Copied
Ok, so I have a little more info.
So far I have tried:
- Changing file permissions on the processing page.
- Verifying that the upload directory has write permissions.
- urlencodedformatting both the session token and the entire pagename?token combo
- Specifying both the processing page by filename and by /path/filename
- session and jsession session variables
When I specify the processing page in the <cffileupload> tag, I get a 401 error
When I specify it as a /path/filename, I get a 404 error. In the CF error log, it looks like the path is getting passed twice. (/home/username/public_html/home/username/public_html/filename.cfm)
I'm to the point where I'm about ready to buy uploadify.
Copy link to clipboard
Copied
If you didn't have permissions, didn't you get an error message telling you that?
Copy link to clipboard
Copied
Oddly, no. I copied my single-file uploader into the admin folder, and when I uploaded a single file, I got my generic error from Application.cfc. When I commented the error handler out, I got the actual error and knew Tim was right. The multi-file uploader didn't give me any clue about what was wrong.
So, now that files are uploading, how do you get the page to do something else once the files have uploaded. Is the JS route the only way? I'd like to forward to a processing page after the upload where I can do things like pick an album for the photos. Unless of course there's a way to associate them with an album at the time of upload.
Copy link to clipboard
Copied
I sort of solved this by wrapping the cffileupoad with a form tag with an action pointing to my processing page, then adding a submit button with the value of "Next". Now I can forward to my processing page with a click after the files are uploaded.
Trying to do it with a JS function connected to the cffileupload tag resulted in a 302 error.