Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A pseudo file-uploader?

 
Roberto Betancourt
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello, I'm building a simple app with Icefaces and i need a file uploader that doesn't actually upload anything, i just need to get the string of the path that the client computer selects in the file explorer. I've already tried with the following code:

<ice:form id="contentForm">
<ice:panelGrid columns="1" id="panelGrid2">


<ice:inputFile id="input" binding="#{Calendario.input}" actionListener="#{Calendario.Link_processAction}"/>

</ice:panelGrid>
</ice:form>

and the actionListener for the upload button:


This always results in a null and the selected file gets "uploaded" in the netbeans project folder, which is a negative consequence for me.

Thanks for the help
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The fileupload JSF control renders as an HTML <tinput type="file"> tag (or something close to that). The processing of this tag is done by the user's client application (web browser), and, by definition, when an HTML form is submitted with a multipart MIME type, the contents of the selected file are MIME-encoded and bundled into the data stream that the user's browser transmits to the server. Which means that you'd need a custom browser with "pseudo file upload" capabilities to make that work.

I'm not sure what benefit comes from telling the server the path of the client's file gives, anyway, since weeb servers aren't allowed to reach down and fetch client's files anyway.

And, BTW, Internet Explorer uploads the complete absolute pathname, but other browsers such as Firefox upload relative paths. I think that's actually an IE bug.
 
Keerthi P
Ranch Hand
Posts: 203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to add enctype="multipart/form-data" to your form tag. The standard h:form supports this attribute. Typical usage is as below:

You seem to be using ice faces. Check the documentation of ice:form tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic