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
https://forums.phpfreaks.com/topic/274379-file-storing-problem/
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.

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.