How can I get file.path in plupload?

非 Y 不嫁゛ 提交于 2020-01-05 05:49:04

问题


I have existing code to get 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 ? I need to get the directory path for each image that I upload.


回答1:


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).

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.

For further reference, have a look at : Is this possible to get full client path in <asp:FileUpload> button?



来源:https://stackoverflow.com/questions/18224551/how-can-i-get-file-path-in-plupload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!