Jump to content

Generate unique string


houssam_ballout

Recommended Posts

 

Hello,

I had a form in which users can upload their photos, but if 2 files had the same name, then it won't upload.

I need to make the file names, something like the one downloaded from facebook (in which filenames can get their string name using some php code) which is a lengthy.

Any help?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/198947-generate-unique-string/
Share on other sites

The session is the logged in users id. (Will need to be changed to suit your needs)

So.. for definately more than 1 user cannot have the same file uploaded, as it'll have the users unique ID in it.

As for the time() this gives it a unique timestamp, for the sake of duplication of the image. (Users may have the same filename on two images for example, the timestamp will allow users can upload 2 pics with the same filename)

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.