Creating a File Upload
Here is the form that I have now:
http://www.housing.uwaterloo.ca/profiles/individual.php
I have it mostly writing to the database now, and I'm ready to create the file upload. Will I have to send them to a separate page to do that? i'm guessing yes.
Also, if I'm going to do that, it would be good to let them review and make changes to the form before it is submitted. How can I do that?
pr0gr4mm3r posted this at 18:03 — 18th January 2007.
He has: 1,502 posts
Joined: Sep 2006
Are you talking about the photo upload? You don't need a separate page for that. See http://us3.php.net/features.file-upload for information on handling file uploads.
Megan posted this at 19:05 — 18th January 2007.
She has: 11,421 posts
Joined: Jun 1999
That is helpful, thanks. So then since I only have one form on the page, there should be no "upload" button, right? It would just be uploaded from the submit button on the bottom? And the file upload code will go in with the other form insertion code?
I think it would be good to be able to review their answers before they submit the page officially, so I think I will try to get sessions working anyway. It might be better to do the file upload on a separate page if I can. There needs to be some immediate feedback there so they know the file has been uploaded successfully.
Conrad - sorry, I've already started doing this with PHP and I don't have ASP available on this server anyway so PHP it is!
Megan
Connect with us on Facebook!
Megan posted this at 14:52 — 19th January 2007.
She has: 11,421 posts
Joined: Jun 1999
Well, it's not working at all. I think it might be a problem with permissions, because I'm on a Windows server. And it's not coming up with a temp directory either. Any ideas?
Edit: no, wait, it is working! It just won't do files with a .jpg extension, only .jpeg... How do I fix that?
Megan
Connect with us on Facebook!
pr0gr4mm3r posted this at 15:00 — 19th January 2007.
He has: 1,502 posts
Joined: Sep 2006
I don't have any experience on a windows server. Are you getting the error when you try to move the uploaded file?
Megan posted this at 15:29 — 19th January 2007.
She has: 11,421 posts
Joined: Jun 1999
The upload works fine if I rename the file extension to .jpeg. It just chokes when it's a .jpg extension (doens't recognize it at all or put anything into the $_FILES array).
Edit: No, wait, now it is putting info into the $_FILES array but it's not getting a tmp directory or file type... will try this again with a different jpg file. Ah, okay, it might have just been that particular file I was trying...
Megan
Connect with us on Facebook!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.