nilsk123 Posted August 27, 2008 Share Posted August 27, 2008 I have a very basic file uploading script, as you can see it will always rename the uploaded file to the same name, its meant to be that way. However, I want it to overwrite the old file when a new one is uploaded. Now it always ignores the request because the file is allready there. How would this be accomplished? <?PHP $target = "upload/verkoopcijfers.mht"; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "Het bestand is succesvol geupload."; } else { echo "Er was een onverwacht probleem tijdens het uploaden van het bestand, probeer het aub opnieuw."; } ?> Link to comment https://forums.phpfreaks.com/topic/121536-solved-very-easy-file-uploading-question/ Share on other sites More sharing options...
JonnoTheDev Posted August 27, 2008 Share Posted August 27, 2008 Upload to a tmp folder, move the file, delete the tmp upload Link to comment https://forums.phpfreaks.com/topic/121536-solved-very-easy-file-uploading-question/#findComment-626762 Share on other sites More sharing options...
nilsk123 Posted August 27, 2008 Author Share Posted August 27, 2008 I'm not quite sure what you mean, all I need is a piece of code that tells it that it may overwrite if necessary. Link to comment https://forums.phpfreaks.com/topic/121536-solved-very-easy-file-uploading-question/#findComment-626763 Share on other sites More sharing options...
nilsk123 Posted August 27, 2008 Author Share Posted August 27, 2008 nevermind, I'll unlink after request. Link to comment https://forums.phpfreaks.com/topic/121536-solved-very-easy-file-uploading-question/#findComment-626788 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.