Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php - multi-step form with file upload

I can't seem to find clarification. I have 7 steps and the second one is to upload a file. The problem I am having is that on the final step when I finalize the form and try and access the temp file it says "Could not access file: ..." (saved in the default tmp folder).

Other multi-step tutorials say to keep it in a temp folder and then move to the appropriate folder when complete. So do they mean I move it from the default temp folder into a temp folder I manage and then when they complete the form move it again to a final folder?

like image 614
user162941 Avatar asked Sep 03 '26 13:09

user162941


1 Answers

So do they mean I move it from the default temp folder into a temp folder I manage and then when they complete the form move it again to a final folder?

Yes, exactly. You do the first move on the request that receives the files, because when that request is finished PHP would delete them if they still exist.

See move_uploaded_fileDocs and Handling File Uploads.

like image 88
hakre Avatar answered Sep 05 '26 03:09

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!