通过$ _FILES或php://输入上传文件? 哪个系统更好?
I am creating a script that via my iOS application I can upload a file. I was wondering which method is better or safer for the system? $_FILES
or php://input
? Does it matter? I am curious to know because users will need to upload multiple files at once, for example one user may upload one photo but 10k are doing it at once. I am just trying to prepare for a situation like that.
Any suggestions on this? I know $_FILES
writes to the temp directory, I believe php://input
does not though (does it use system memory)? Please help me understand. I found a few other threads on this but nothing specifically said how it affects the system & which one is better for my situation.
The files will not be bigger than 2MB at most.
我正在创建一个脚本,通过我的iOS应用程序,我可以上传文件。 我想知道哪种方法对系统更好或更安全? 对此有何建议? 我知道 文件最多不会超过2MB。 p>
div> $ _ FILES code>或
php:// input code>? 有关系吗? 我很想知道,因为用户需要一次上传多个文件,例如一个用户可以上传一张照片但是10k一次就可以上传。 我只是想为这样的情况做准备。 p>
$ _ FILES code>写入临时目录,我相信
php:// input code>不会(它是否使用系统内存)? 请帮我理解。 我在此发现了一些其他线程,但没有具体说明它如何影响系统和& 哪一个更适合我的情况。 p>
Regardless of whichever you choose, php will always have the entire file in memory due to the way php handles file uploads.
I'd stick with $_FILES
, it's already there to help you with the handling of file uploads with PHP.