Jump to content

file storing problem


alena1347

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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