输入文件的绝对路径[type = file] [英] Absolute path to file on input[type=file]

查看:113
本文介绍了输入文件的绝对路径[type = file]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用javascript或jquery获取文件的ABSOLUTE路径?这些是我到目前为止的试验,但我能得到的最接近的只是文件名。

Is is possible to get the ABSOLUTE path to a file using javascript or jquery? These are my trials so far but the closest I can get is just the filename.

    var filepath = $('input[type=file]').val();
    var test = this.files;
    var test2 = test[0];
    var test3 = test2.fileName;
    var test4 = test2.filePath;
    var test5 = test2.Name;
    var h = imageInput.value;
    var b = document.getElementById("AcademicPhotoId");
    var l = b.value;
    var binary = b.getAsBinary();
    $('.image-display img').attr('src', filepath);


推荐答案

不,这将是违反安全规定的行为。 (它可以告诉你用户的名字等,即 c:\Users\Kirk \Desktop \ uploadedfile.txt

No, that would be a security violation. (It could tell you the user's name, etc. i.e. c:\Users\Kirk\Desktop\uploadedfile.txt)

出于好奇,你为什么要这些信息?

Out of curiosity, why do you desire this information?

这篇关于输入文件的绝对路径[type = file]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆