Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: PHP Upload

  1. #1
    New Coder
    Join Date
    Jan 2009
    Posts
    33
    Thanks
    6
    Thanked 0 Times in 0 Posts

    PHP Upload

    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?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,531
    Thanks
    8
    Thanked 1,091 Times in 1,082 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 filename
    photo description
    photo keyword list
    who uploaded it
    client info
    timestamp
    assigned teacher

    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •