我正在尝试从 HTML 表单上传一个 zip 文件和一个 csv 文件。
在 PHP 上,当我打印 $_FILES(实际上是 symfony 中的 $request->getFiles())时,我得到了关注。
Array
(
[zipfile] => Array
(
[name] => tempfiles.zip
[type] => application/octet-stream
[tmp_name] => C:\wamp\tmp\php5D42.tmp
[error] => 0
[size] => 850953
)
[csvfile] => Array
(
[name] => test.csv
[type] => application/vnd.ms-excel
[tmp_name] => C:\wamp\tmp\php5D52.tmp
[error] => 0
[size] => 312
)
)
我想知道type
and tmp_name
。我需要根据类型做出一些决定。对现有类型做出决定是否安全?对于 Linux 服务器上的类似文件,我会得到相同的结果吗?
再次tmp_name
有.tmp
扩展。它在 Windows/Linux 上是否一致?如果没有,有什么方法可以让我在 Windows 上编写的代码(使用决定type
)在 linux 上运行没有任何问题?