Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 787
animuson Avatar asked Jul 13 '10 03:07

animuson


People also ask

How long do files stay on discord?

Our database backups are stored for 30-45 days upon which they are deleted. Compliance with our legal obligations. We may need to retain certain information for longer periods to comply with legal requirements.

Where do uploaded files go?

Uploaded files are saved to the /files directory.

What happens when a file is uploaded?

Uploading is the transmission of a file from one computer system to another, usually larger computer system. From a network user's point-of-view, to upload a file is to send it to another computer that is set up to receive it.

How are files uploaded to server?

The commonly way to upload data to the server is using FTP client. FTP (File Transfer Protocol) is used to transfer data from one computer (your personal computer) to another computer (webserver). FTP client looks like File Manager and you can copy (upload, download) files here from one computer to another computer.


2 Answers

Unless PHP dies a horrible flaming death, or you take steps to preserve the file, it'll be auto-killed by PHP when the script exits. If you need to preserve it through a multi-stage form, you'll have to move it somewhere safe, and then keep track of it (hidden form fields, session, database, etc...) and implement your own cleanup system to handle orphaned files from abandoned forms.

like image 83
Marc B Avatar answered Sep 17 '22 15:09

Marc B


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.

like image 36
Your Common Sense Avatar answered Sep 19 '22 15:09

Your Common Sense