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.

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

报告相同问题?

悬赏问题

  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码