简体   繁体   English

PHP:从路径获取文件作为上载文件

[英]PHP: Get a file from path as a uploaded file

I want to forward a file with a known path to a script that was intended for $_FILES["uploadfile"]. 我想将具有已知路径的文件转发到打算用于$ _FILES [“ uploadfile”]的脚本。 So how to get this code working: 那么如何使此代码正常工作:

<?PHP
$uplfile = "somefileinscriptdirectory.txt";
echo $uplfile["name"];
echo $uplfile["size"];
?>

Is there a way to get a file handle on the txt-File to work with like you would with a $_FILES[...]? 有没有办法像使用$ _FILES [...]一样在txt-file上使用文件句柄?

Thank you in advance! 先感谢您!

Have you tried fileinfo ( which is apparently native since php 5.3.0 )? 您是否尝试过fileinfo(自php 5.3.0起显然是本地的)? http://us1.php.net/manual/fr/function.finfo-file.php http://us1.php.net/manual/fr/function.finfo-file.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM