问题
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