跳转到主内容
趣航编程网 - 趣学编程,启航技术之路!

多文件上传[Flash]插件,PHP版的一个问题

http://www.cnblogs.com/zjfree/archive/2011/01/06/1929100.html上面地址中,在内容说明中有个php上传代码,这个php代码要怎么取得原文件名?

php代码:php
 0){$f = current($_files);move_uploaded_file($f["tmp_name"], $img_path);}else{$rawpostdata = file_get_contents("php://input");$myfile = fopen($img_path, "w") or die("unable to open file!");fwrite($myfile, $rawpostdata);fclose($myfile);}echo $img_url;?>回复讨论(解决方案)$rawpostdata = file_get_contents("php://input"); //读取传入的流$myfile = fopen($img_path, "w") or die("Unable to open file!");fwrite($myfile, $rawpostdata); //将得到的数据写入文件fclose($myfile);显然他并没有传递文件名,自然你也就得不到了但如果视奏这个分支的if (count($_FILES) > 0){$f = current($_FILES);move_uploaded_file($f["tmp_name"], $img_path);}$f["name"] 就是原始文件名$rawpostdata = file_get_contents("php://input"); //读取传入的流$myfile = fopen($img_path, "w") or die("Unable to open file!");fwrite($myfile, $rawpostdata); //将得到的数据写入文件fclose($myfile);显然他并没有传递文件名,自然你也就得不到了但如果视奏这个分支的if (count($_FILES) > 0){$f = current($_FILES);move_uploaded_file($f["tmp_name"], $img_path);}$f["name"] 就是原始文件名谢谢解释,看明白了,读取传入的流 方式时只有图片流信息,没有文件名信息

相关文章