PHP File Name

Soldato
Joined
30 Nov 2005
Posts
3,084
Location
London
Developing an Upload in PHP and want to change the uploaded file name to the record ID in the MySQL database.

So basicaly when the user uploads, the file name is changed to become the record ID. This means that there will never be the same file name, because the ID is an Int and auto_increment.

Not sure the best way to do this is.

Any ideas?

Cheers all.
 
Last edited:
Thanks, I saw that but because I'm uploading directly into the MySQL database (I know it's wrong to do it this way, so don't ask:rolleyes:), does this not apply?
 
Last edited:
Wait, because I'm storing it directly in a database would it matter if two file names where the same? Because the file table has auto_increment ID's and also stores the User who uploaded it's ID, it would already be unique?

Gosh I'm confused. I think I don't need to change the file name after all?
 
Back
Top Bottom