0

我正在尝试构建一个可以执行此操作的 Web 应用程序: 1. 通过 Web 应用程序,用户选择他机器文件系统上存在的一些文件。2. Web 应用程序然后提取所选文件的元数据,如文件名、大小、文件类型,并将其存储在服务器的数据库中。

所以我需要两件事 - 1. web 应用程序应该能够访问用户的文件系统和 2. web 应用程序应该能够提取所选文件的元数据。

是否有可能做到这一点?

谢谢!

4

3 回答 3

0

The webserver cannot access the users file system to get this meta information without the help of browser plugins. The only way this information becomes accessible to the server is after the upload is complete.

于 2012-04-06T12:43:14.830 回答
0

如果进行了上传,则可以使用 javascriot(html 5 file api) 直接访问文件名、大小、路径、最后修改日期和文件类型。否则,对于所有极端元数据(比特率和图像尺寸等),必须使用 php 接口。

于 2013-05-23T04:48:53.360 回答
0

是的,http://jsfiddle.net/Fs7dM/2/

$("input").bind("change", function(e) {
    var files = this.files;

    if (files && files.length) {
        var pre = $("#log");
        [].forEach.call(files, function(file) {
           pre.append( (file.fileSize || file.size) + " " + (file.fileName || file.name) + " " + file.type +"\n");
        });
    }
});​
于 2012-04-06T13:00:42.530 回答