PHP $ _FILES文件循环上传 [英] PHP $_FILES file loop upload
本文介绍了PHP $ _FILES文件循环上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从php函数将文件插入mysql. 服务器上已经存在需要上传的文件,因此我不想使用上传表单.
I want to insert files into mysql from php function. The files that need to be uploaded are already present on the server, so I don't want to use the upload form.
我想遍历目录并将文件信息获取到$_FILES
.
I want to loop through the directory and get the files info into $_FILES
.
请让我知道如何将$file
放入$_FILES
,然后调用上载.
Please let me know how I will get the $file
into $_FILES
and then call upload.
$dir_handle = @opendir($path) or die("Unable to open folder");
while (false !== ($file = readdir($dir_handle))) {
echo "$file";
}
推荐答案
$ _ FILES仅用于处理客户端上载到脚本的文件.您应该可以使用file_get_contents()
或fopen()/fread()
插入文件内容,而无需费心.
$_FILES is solely for handling files uploaded to the script by the client. You should be able to insert the file contents using file_get_contents()
or fopen()/fread()
without further ado.
这篇关于PHP $ _FILES文件循环上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文