Retrieve uploaded relativePath file on server side

2019-08-22 12:22发布

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.

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.

Thanks for your help.

1条回答
太酷不给撩
2楼-- · 2019-08-22 12:37

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

(file containing webKitRelativePath)

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

查看更多
登录 后发表回答