Jump to content


Photo

file storing problem

files images php rename

  • Please log in to reply
1 reply to this topic

#1 alena1347

alena1347

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts

Posted 12 February 2013 - 02:10 AM

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.

#2 kicken

kicken

    Wiser? Not exactly.

  • Gurus
  • 2,707 posts
  • LocationBonita, FL

Posted 12 February 2013 - 08:07 AM

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.
Recycle your old CD's, don't trash them!
Did I help you out?  Feeling generous? I accept tips via Paypal or Bitcoin @ 14mDxaob8Jgdg52scDbvf3uaeR61tB2yC7




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com