File upload keeping POSIX attributes

We have java nio now and with that comes the support for modifying file permissions. http://docs.oracle.com/javase/tutorial/essential/io/fileAttr.html

Given that, I want to upload a file to the server keeping the POSIX file attributes (rwx for user,group,other) from the original file. I tried using the core Upload and the MultiFileUpload addon, but both hides the actual file from me behind a stream. I can’t get the attributes from an inputstream. It wouldn’t be a problem if I get a java.io.File object becouse I could convert it to java.nio.Path easily (hopefully this would keep the attributes).

Any ideas how can I keep the original file’s attributes?

Hello Adam,

I think this won’t be possible. You may want to read RFC 1867
http://tools.ietf.org/html/rfc1867

All you get is a Stream with the content of the file and some header data. But I don’t think the file system’s specific information will be available.
I’m not to familar with the JavaScript File API
http://www.w3.org/TR/file-upload/
but I didn’t find any suggestions how to read the file permissions. IF there is a way to do this with JavaScript you could read this permissions and extend your Upload UI.
But this really is against the sandbox philosphy of JavaScript access.