alena1347 Posted February 12, 2013 Share Posted February 12, 2013 I am trying to store images in a folder on server. For some reason the images that need to be uploaded should be with their orignal name as uploaded by user i.e they can be changed only wth the original name in it. 1)So how can i put it in folder using php and retrieve it wherever needed whch means the name should be in database. 2)Now in the folder if two files with the same name are uploaded then the latest would overwrite whch should be avoided. Plz could anyone give some way to make ths up. Quote Link to comment Share on other sites More sharing options...
kicken Posted February 12, 2013 Share Posted February 12, 2013 Your questions are not very clear, but here's my best guess at answers 1)So how can i put it in folder using php and retrieve it wherever needed whch means the name should be in database. Yes, you'd store the name of the file in your database somewhere so that you know which file to grab when you need it. 2)Now in the folder if two files with the same name are uploaded then the latest would overwrite whch should be avoided. To avoid the overwrite you need to either use separate directories, or alter the name of the file in some way. For example, add the user's ID# as a prefix so if they upload photo.png you'd rename it on save to 1479_photo.png. 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.