使用表单上传文件并将文件路径设置为simplexml_load_file

时间:2018-12-11 18:53:17

标签: php forms file-upload simplexml

我想使用表单上传文件,然后在目录中获取其完整路径以使用simplexml_load_file()进行调用。我尝试此操作没有任何积极结果:

/ home / user-linux / Desktop / web / WebProjectbool(false)

要上传的文件:选择文件 data.kml

按此按钮上传

<?php

$filePath = realpath($_FILES["file"]["UploadFileName"]);
echo $filePath;//just to see if i am getting the righ path

$parse = simplexml_load_file($filePath);
var_dump($parse);

?>
<html>
    <head>
    </head>
    <body>
        <form method="POST" action="example2.php" enctype="multipart/form-data">
            <p>File to upload : <input type ="file" name = "UploadFileName"></p> 
            <br />
            <input type = "submit" name = "Submit" value = "Press THIS to upload">
        </form>
    </body>
</html>

0 个答案:

没有答案