Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: PHP Upload
10-24-2009, 03:44 AM #1
- Join Date
- Jan 2009
- Thanked 0 Times in 0 Posts
How would I go about creating a php image upload form that assigns whatever I pick from a drop down list and renames the image file that is selected for upload to that and uploads it to my server at the same time? If my question is confusing... please read...
I want to create this form where a person can upload a picture of one of our client's artwork. However, we want to assign it to a teacher in our institute lets say. The person will come to this webpage, and there will be two form elements--the drop down list of teachers and the file browser for the image wanting to upload. Once, submitted--it will then change the file(s) name, preferrably multiple image uploads, and put it in a CHMOD 777 folder on our server. With multiple uploads to the same teacher, the script would need to have an ongoing number at the end (for example... smith5.jpg smith6.jpg..)
How does one go about doing this?
10-25-2009, 12:49 AM #2
- Join Date
- Jun 2003
- Cottage Grove, Minnesota
- Thanked 1,096 Times in 1,087 Posts
You upload ALL photos to the same directory, and use MySQL to keep track
of which photos are assigned to which teachers. That way, the database can
be queried, searched, sorted, easily edited, and all photos can be easily maintained.
The photos can either retain their original filenames, or you can rename them however
you want. No dealing with adding numbers or figuring that out. If you do what you
want, it will be difficult to delete or add photos in the middle, and it's hard to keep
track of the last number.
Using MySQL makes everything 1000% easier for you.
Each MySQL entry has:
auto-increment ID record number
photo keyword list
who uploaded it
and any other fields you need, or can think of.
A photo can be assigned to a different teacher with the click of button,
merely by changing the "assigned teacher" field for that record, or a
group of records. The photos remain untouched, as the database does
all of the record keeping.
Perhaps you want a query of all photos with the keyword "modern".
A quick search brings them up in a list as the database keywords are search for the target string.
Adding, Deleting, Updating, Moving, Searching ... whatever you want to do.
Last edited by mlseim; 10-25-2009 at 12:55 AM.