php使用预定义的文件名上传多个文件

时间:2016-02-04 03:09:14

标签: php

我想上传多个带有预定义文件名的文件,是否可能?如何从PHP中检索名称?

如何检索名称' doc1'和' doc2'来自php?

我的代码:



while(condition)




1 个答案:

答案 0 :(得分:0)

请检查下面的php代码,它会返回您上传的文件的所有详细信息。

if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") 
 {  
    echo "File Names:<br>Doc1= ".$_FILES['files']['name']["'doc1'"];
    echo "<br>Doc2= ".$_FILES['files']['name']["'doc2'"];
    echo "<br><br>";

    echo "File Types:<br>Doc1= ".$_FILES['files']['type']["'doc1'"];
    echo "<br>Doc2= ".$_FILES['files']['type']["'doc2'"];
    echo "<br><br>";

    echo "Tmp Name:<br>Doc1= ".$_FILES['files']['tmp_name']["'doc1'"];
    echo "<br>Doc2= ".$_FILES['files']['tmp_name']["'doc2'"];
    echo "<br><br>";

    echo "Error:<br>Doc1= ".$_FILES['files']['error']["'doc1'"];
    echo "<br>Doc2= ".$_FILES['files']['error']["'doc2'"];
    echo "<br><br>";

    echo "Size:<br>Doc1= ".$_FILES['files']['size']["'doc1'"];
    echo "<br>Doc2= ".$_FILES['files']['size']["'doc2'"];
    echo "<br><br>";
 }
?>