Reputation: 3280
i tried so to get uploaded file absolute path but i didn't find a solution : i know that i can't get the uploaded files absolute client side path. Limitation of the browser since that is considederd a security risk. so if i use p:uploadeFile simple mode :[ http://www.primefaces.org/showcase-labs/ui/fileUploadSimple.jsf][1]
It will be an inputText field containing the absolute path of the selected project so can i retrieve it in my managed bean before clicking on the submit button (i mean uploading the file to the server the file to server )
<p:fileUpload value="#{fileUploadController.file}" mode="simple"/>
<p:commandButton value="Submit" ajax="false"
actionListener="#{fileUploadController.upload}"/>
And many thanks
Upvotes: 0
Views: 1281
Reputation: 1109745
You can't. Some older browsers with security bugs may give you the full path on HtmlInputElement#value
in JavaScript, but all modern browsers only give the base filename back and others even prepend it with a fake path such as c:\fakepath
in IE and Webkit browsers.
You shouldn't be interested in this information anyway. This is completely irrelevant to any self-respected business logic processing an uploaded file. Whatever functional requirement you thought to solve with this has to be solved differently.
Upvotes: 3