[英]how to get the uploaded file path using html , javascript , php
I am uploading am image from my drive, it is uploaded successfully but I am unable to get the folder path of that image我正在从我的驱动器上传图像,它已成功上传,但我无法获取该图像的文件夹路径
for example:例如:
E:\Allied logo\Allied Logo images E:\Allied 标志\Allied 标志图片
$('#pngfile').change(function (e) {
var tmppath = URL.createObjectURL(e.target.files[0]);
console.log(this.files,tmppath);
})
It'll give you a temporary path not the accurate path, you can use this script if you want to show selected image.它会给你一个临时路径而不是准确的路径,如果你想显示选定的图像,你可以使用这个脚本。
Here is the code:-这是代码: -
HTML:- HTML:-
<input type="file" id="i_file" value="">
<input type="button" id="i_submit" value="Submit">
<br>
<img src="" width="200" style="display:none;" />
<br>
<div id="disp_tmp_path"></div>
JS: - JS: -
<script type="text/javascript">
$('#i_file').change( function(event) {
var tmppath = URL.createObjectURL(event.target.files[0]);
$("img").fadeIn("fast").attr('src',URL.createObjectURL(event.target.files[0]));
$("#disp_tmp_path").html("Temporary Path(Copy it and try pasting it in browser address bar) --> <strong>["+tmppath+"]</strong>");
});
</script>
Jquery Jquery
<script type="text/javascript">
$(function(){
$('#fiad').change( function(event) {
var tmppath = URL.createObjectURL(event.target.files[0]);
$("img").fadeIn("fast").attr('src',tmppath);
});
});
</script>
Html Html
<input type="file" id="fiad"><br><br>
<img src="" width="200" style="display:none;" />
you get file path inside tmppath
here.您在此处获得
tmppath
内的文件路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.