简体   繁体   English

如何在plupload中获取file.path?

[英]How can I get file.path in plupload?

I have existing code to get file.name 我已有代码来获取file.name

    uploader.bind('FilesAdded', function(up, files) {
    $.each(files, function(i, file) {
        $('#filelist').append(
            '<div id="' + file.id + '">' +
            file.name + ' (' + plupload.formatSize(file.size) + ') <b></b>' +
        '</div>');
    });

    up.refresh(); // Reposition Flash/Silverlight
});

I got the file.name and file.id but how can I get the file.path or file.originalPath ? 我得到了file.name和file.id,但是如何获得file.path或file.originalPath呢? I need to get the directory path for each image that I upload. 我需要获取我上传的每个图像的目录路径。

On older browsers you could get hold on the file path on the client machine. 在较旧的浏览器上,您可以控制客户端计算机上的文件路径。 On modern browsers, you can't get this info (except maybe for trusted sites in IE). 在现代浏览器上,您无法获取此信息(可能是IE中受信任的网站除外)。

Giving too much info about the directory structure of the client machine is considered a security issue. 提供过多有关客户端计算机目录结构的信息被视为安全问题。 You can not access it with javascript, and it is not posted to the server. 您无法使用javascript访问它,它也不会发布到服务器上。

For further reference, have a look at : Is this possible to get full client path in <asp:FileUpload> button? 有关更多参考,请参阅: 是否可以在<asp:FileUpload>按钮中获取完整的客户端路径?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM