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

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

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.