Jump to content

uploading with php


kat01

Recommended Posts

I assume you mean 'if file exists, overwrite?'..  You could store the temporary file name ($_FILES['tmp_name']) within a session variable, prompt the user, then if they agree "move_uploaded_file". Would it not be better to use a system where you don't get duplicate file names though?

Link to comment
https://forums.phpfreaks.com/topic/184776-uploading-with-php/#findComment-975463
Share on other sites

The temp uploaded file is actually deleted automatically when the script on the page that is the target of the form finishes execution, so you would actually need to store the whole temp uploaded file somewhere and a session variable is about the best place if you want it to be automatically deleted once you are finished with it.

Link to comment
https://forums.phpfreaks.com/topic/184776-uploading-with-php/#findComment-975466
Share on other sites

Actually just found out the file is deleted at the end of the request. In that case then you could move the file to another location, temporarily, while you prompt the user to overwrite the original. Or .. Something as simple as a check box actually as they upload the file could be easier.

 

Edit: Heh,  PFMaBiSmAd beat me to it.

Link to comment
https://forums.phpfreaks.com/topic/184776-uploading-with-php/#findComment-975468
Share on other sites

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.