Reusing the temporary file created by a file upload in a PHP form

旧时模样 提交于 2019-12-10 15:48:26

问题


regarding file uploads, I have a form through which I upload a file, I get the $temp_name = $_FILES['name']['temp_name'] and store it in a variable.

Can I then use that variable again inside move_uploaded_file("$temp_name","$location") inside another form.

Will this work??

When we upload a file, there is a temp location created on the server. How long can the temporary file be used for?

Thanks.


回答1:


You can only use that name in the script which receives the upload since the temporary file will only last until the end of your script's execution. If you want to reuse the file you have to save it permanently.



来源:https://stackoverflow.com/questions/2301814/reusing-the-temporary-file-created-by-a-file-upload-in-a-php-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!