aspose file tools*
The moose likes JSF and the fly likes A pseudo file-uploader? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "A pseudo file-uploader?" Watch "A pseudo file-uploader?" New topic
Author

A pseudo file-uploader?

Roberto Betancourt
Greenhorn

Joined: Oct 23, 2009
Posts: 1
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

Joined: Jun 25, 2001
Posts: 15641
    
  15

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Keerthi P
Ranch Hand

Joined: Aug 19, 2003
Posts: 203
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.


Cheers.<br />Keerthi<br />(SCJP, SCWCD, SCBCD)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A pseudo file-uploader?
 
Similar Threads
Uploading both local and hosted files
how to convert a bunch of string into a file array and then upload it ?
To Refresh the Dynamic data to the JSF Page automatically
Icefaces - PanelGrid align
HOW TO REFRESH THE FULL PAGE USING JSF ICE FACES AND TO GET THE UPDATED RECORDS INTO PAGE