dongxuxian1123 2017-03-10 17:13
浏览 53
已采纳

如何在php中读取文件路径

I am looking for file path store in local system for eg. when I select file and post to another page then I Just want it's real path.

<form action="post.php" method="post" enctype="multipart/form-data">

    Select File: <input type="file"  name="file"> 

   <input type="submit" name="submit" value="Upload File!" /> 

 </form>

I know how to upload file but I don't wan't to upload file Just want to read path of that selected file for Eg.

C:/Users/Public/Pictures/Sample%20Pictures/Koala.jpg

Actually I am working on Exeoutput for PHP 2 it's running on local server so when user upload file it's not support file upload so am trying to store file path for image upload , so when ever program will start so selected image will autoamtically will show

   <img href='C:/Users/Public/Pictures/Sample%20Pictures/Koala.jpg'/‌​>

Thanks In Advance

  • 写回答

1条回答 默认 最新

  • douhan1992 2017-03-10 17:48
    关注

    You can't.

    File inputs are designed to upload files.

    For security reasons, they conceal information about where exactly the file came from. In the context of the WWW, it should not matter to the server where the user kept the file on their computer.

    Even though you are using an HTTP server and web browser in a non-WWW content, you can't override these security features.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?