whiteboikyle Posted January 13, 2009 Share Posted January 13, 2009 Okay well i am creating a site which will have a user gallery. AKA Each member will be able to upload their photos. (Kinda like myspace). Now, a few questions. When they upload their image. Should i encrypt the name? and/or Randomize the name? When they upload, how can i check to see if that number already exist or not? But when i do this, its going to be like the following image.php?userID=theiruserid&picID=picID or w/e so that it will only find the pic for each userid that was assigned to it. Quote Link to comment Share on other sites More sharing options...
Caesar Posted January 13, 2009 Share Posted January 13, 2009 You can always do something like... <?php $img_name = md5(time()).$extension; ?> Not very likely you'll have duplicates unless, the time/date on the server is changed. Edit: I assume you're going to store/log the fact they uploaded an image in your db. So yeah, you store the image name and in the same table, the user id associated with it. Quote Link to comment Share on other sites More sharing options...
dawsba Posted January 13, 2009 Share Posted January 13, 2009 id add on to caesar's note and add $file_name = md5(time()).extension; while(file_exists($file_name)){$file_name = rand(1,1000).$filename;} just in case of server bugs etc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.