在服务器端检索上载的relativePath文件 [英] Retrieve uploaded relativePath file on server side

查看:63
本文介绍了在服务器端检索上载的relativePath文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于jQuery-File-Upload的Primefaces(JSF框架)中的fileUpload.多亏了Firefox或Chrome浏览器的新File API,我正在尝试使此组件支持拖放文件夹. https://developer.mozilla.org/zh-美国/docs/Web/API/HTMLInputElement/webkitdirectory#Example 到目前为止,由于passthrough属性,我已经能够实现它.

I'm using fileUpload from Primefaces (JSF framework) based on jQuery-File-Upload. I'm trying to make this component supporting drag&drop folder thanks to new File API of Firefox or Chrome. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory#Example So far, I've been able to make it happen thanks to passthrough attribute.

有趣的功能之一是"webkitRelativePath",它允许知道上载文件的相对路径.

One of the interesting feature is "webkitRelativePath" allowing to know the relative path of an uploaded file.

我想知道如何在服务器端检索此信息,以便可以使用此新信息创建对象.

I'm wondering how I could retrieve this info on server side, so I can create an object with this new info.

感谢您的帮助.

推荐答案

好吧,我刚刚从fileupload.js中读取了他:

Well I just read his from fileupload.js:

_initXHRData: function (options) {
     ...
     formData.append(
     ($.type(options.paramName) === 'array' &&
          options.paramName[index]) || paramName,
          file,
          file.uploadName || file.name
     );
     ...
}

(包含webKitRelativePath的文件)

(file containing webKitRelativePath)

所以我想信息已经传递到服务器了,您不觉得吗?因为我使用的是Servlet 3.0,所以我应该能够从Part对象中检索到它,但要手指交叉...

So I guess the info is already pass to the server, don't you think? Since i'm using Servlet 3.0, I should be able to retrieve it from Part object, finger crossed...

这篇关于在服务器端检索上载的relativePath文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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