Search code examples
phpformspostuploadtemporary-files

How long do uploaded files stay on your server?


When I use a form to upload a file, it gives me the 'name' and 'tmp_name' and you're supposed to move the file from its temporary location in order to keep it. But how long does the file stay on the server before it gets deleted? Is it stored there permanently until you manually clean up your folders, or does it get deleted once the PHP script it was submitted too is finished running? My form spans over multiple pages and I wanted to just process everything at the end rather than processing parts after each page of the form is completed. The upload is in step 3 of 5 so I was wondering if I saved the uploaded file information from step 3, if the file would still be there when the form is finished after step 5.


Solution

  • it get deleted once the PHP script it was submitted too is finished running

    so, you can either make file upload as last step or implement your own garbage collector for the unfinished forms.