Jump to content

Upload images with names


dmschenk

Recommended Posts

Lemme rephrase it.  :)

I would like to upload a photo (Example.. image001.jpg) to a directory on my website with a file input field (this much I can do).  I would like to take that name (image001.jpg) from the input field and stick into a database without having to retype the name into a separate field.

So in one move I would like to upload a file "and" populate a db field.

I'm just trying to eliminate places where mistakes can happen.

 

Dave

Link to comment
Share on other sites

well uploaded images should never have the same name as they were updated this is just bad practice as people could upload a file with the same name and you have a bigger issue.  Upload the file, rename it to some linear based system like

USERID_ImageID  and then store that, I don't see what the issue is honestly its just a query

Link to comment
Share on other sites

I'm not exactly sure where you are going with this. I'm just looking for an efficient way to get the database to recognize that something has been stored online.

I can do it with separate fields... I just want to know if and how it can be done with just one field and streamline the process.

 

Dave

Link to comment
Share on other sites

when you upload the image you should check that a file with the same name is not in the same location - if it is you shoudl rename the image that is being uploaded.

 

but back to your specific question - the information about the uploaded file is stored in the $_FILES supre global - you can grab the name of the original from there and add it where ever you like in your database.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.