2

When we upload a file using HTML Form it is uploaded to tmp folder on server first. After file uploading process is completed, We need to move the File to our folders using move_uploaded_file() function.

Why file is first uploaded on tmp folder? Why can't we upload the file to our destination folder directly?

4

1 回答 1

4

如果文件未存储在临时目录中,则整个内容必须存储在内存中,直到脚本完成运行(或调用函数将其从内存中删除)。

给它一些大文件,服务器会耗尽内存,敲打交换分区并可能翻倒。

于 2013-07-20T17:36:40.137 回答