重用PHP表单中的文件上传创建的临时文件 [英] Reusing the temporary file created by a file upload in a PHP form

查看:70
本文介绍了重用PHP表单中的文件上传创建的临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于文件上传,我有一个上传文件的表格,我得到了$temp_name = $_FILES['name']['temp_name']并将其存储在变量中.

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.

然后我可以在另一表格的move_uploaded_file("$temp_name","$location")中再次使用该变量吗?

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

这项工作会吗?

当我们上传文件时,在服务器上创建了一个临时位置.临时文件可以使用多长时间?

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

谢谢.

推荐答案

您只能在接收上载的脚本中使用该名称,因为临时文件将一直持续到脚本执行结束.如果要重用该文件,则必须将其永久保存.

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.

这篇关于重用PHP表单中的文件上传创建的临时文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆