This topic is locked
[SOLVED]

 updating photos

2/21/2010 9:28:17 AM
PHPRunner General questions
H
horsey_kim author

Users are uploading photos to a directory and the file name is stored to the mysql database.
HOWEVER when they go back in to change their photo or delete the photo, the photo is still in the photo directory. Of course the database show correct photo after the update or delete function. BUT the photo directory has the old photo and the new photo. If the user is selecting delete or update for the photo, should this not be removing the old photo from the directory the photos are saved?
This results in unused photos taking up space and there is no way of really knowing which is actually being used or not. Why isn't the old photo not being removed?
Kim <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=13869&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

H
horsey_kim author 2/21/2010

I been thinking.
Is there a way to force the image file names being stored in the photo directory? (I will have about 500 users, maybe more)
Example: I want the photo being upload to have an automatic file name that consist of user & ad# & fieldname . jpg (jane521photo1.jpg)
Then if the user decided to update the photo with a new one, it would write over the old file, because it has the same filename.
I think this would fix the issue of the photo features of delete and update not working correctly to remove the old photo from the photo directory.
Any ideas on how I would be able to force the file name on the photo being updated?
Any help is GREATLY appreciated <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=47948&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

Sergey Kornilov admin 2/23/2010

Old photos are not deleted on purpose - some applications might need this feature.
Changing uploaded file names is quite easy in fact:

http://xlinesoft.com/phprunner/docs/rename_uploaded_file.htm

H
horsey_kim author 2/23/2010

Perfect, thank you. I think this will help with what I need <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=48027&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

H
horsey_kim author 3/3/2010

This solution did not work. Please see my new posting at: http://www.asprunner.com/forums/topic/13965-changing-uploaded-file-name-not-work/pagehlmove%20file%20namefromsearch1
Hopefully it is just something I did wrong.