kev wood Posted April 24, 2008 Share Posted April 24, 2008 hello, i have a file upload system on a website which uploads images to the server and they are then used for display and email purposes. i need the user to be able to over write the files that have been uploaded if the upload a new image. at the minute if the user uploads a new file then the old one still displays and the new file is not on the server. the user can upload 8 different images on to the server and i have just named the image1 through to 8. if they upload an image in the image1 upload i need the old image to be overwritten. if anyone knows how to do this or where a good tutorial is on how to this then i it would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/102693-overwrite-uploaded-files/ Share on other sites More sharing options...
SharkBait Posted April 24, 2008 Share Posted April 24, 2008 As long as the name of the file that is being uploaded is the same and going into the same place it will be overwritten. move_uploaded_file From the PHP Manual: If the destination file already exists, it will be overwritten. Link to comment https://forums.phpfreaks.com/topic/102693-overwrite-uploaded-files/#findComment-526020 Share on other sites More sharing options...
The Little Guy Posted April 24, 2008 Share Posted April 24, 2008 change the name of the file when the user uploads the file, have this filename be static for the user for every image he/she uploads. Link to comment https://forums.phpfreaks.com/topic/102693-overwrite-uploaded-files/#findComment-526033 Share on other sites More sharing options...
kev wood Posted April 25, 2008 Author Share Posted April 25, 2008 i have used the unlink function in php to do this now. Link to comment https://forums.phpfreaks.com/topic/102693-overwrite-uploaded-files/#findComment-527153 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.