Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload CSV and Import - Use temp file?

I want to upload a CSV file and use it just for import content. Is necessary for this to use move_uploaded_file to move temp file? Or should I just use temp file uploaded without moving it in a specific folder? Which will be the best practice?

like image 695
morandi3 Avatar asked Dec 17 '25 20:12

morandi3


1 Answers

There is no need to move the file around if you do not need to keep it longer than the request:

The file will be deleted from the temporary directory at the end of the request if it has not been moved away or renamed.

from POST method uploads

However if you want to move the uploaded file around, you should use move_uploaded_file() for that operation.

like image 184
hakre Avatar answered Dec 19 '25 11:12

hakre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!