You must also set form to right encoding for uploading files:
<h:form enctype="multipart/form-data">
jarin
Kostas Karadamoglou napsal(a):
I tried to do it like the example but myfaces does not access the setter of the property, therefore the attribute is always null.
What do I do wrong?
Here is my code...
<h:form>
<x:inputFileUpload id="fileupload"
value="#{uploader.upFile}"
accept="text/xml"
storage="file"
required="true"/>
<h:commandButton action="#{uploader.addXmlFile}" value="Upload"/>
</h:form>
and...
public class Uploader { private UploadedFile upFile=null; /** Creates a new instance of Uploader */ public Uploader() { }
public UploadedFile getUpFile() { return upFile; } public String addXmlFile(){ //this.upFile.getContentType(); return ""; }
public void setUpFile(UploadedFile upFile) { this.upFile = upFile; } }
David Tashima wrote:
Ah, yeah, I think I got it from the 1.0.8 examples.
Here is some version of it...
Dave
On 4/28/05, Kostas Karadamoglou <[EMAIL PROTECTED]> wrote:
Unfortunately I cannot find the backing bean of the fileUpload example in the cvs do you know where can I find it?
David Tashima wrote:
It puts it into a myfaces UploadedFile (which should be a property on your backing bean).. you have to do the file IO saving part yourself.
Check out the fileupload.jsp sample in the myfaces example directory, that's how I managed to figure it out (the docs are not so good).
-Dave
On 4/28/05, Kostas Karadamoglou <[EMAIL PROTECTED]> wrote:
Hi, I would like to use the x:inputFileUpload but I don't know how
What I have already done is only the filter in the web xml file.
I want to ask you some specific questions
1) Which is the absolute path of the directory that sotes the uploaded files? (Considering that in the web.xml I define a relative path) 2) What should be the type of the attribute that is binded with the value parameter of the x:inputFileUpload? 3)Where can I find more information about using the x:inputFileUpload?
Thank you in advance, Kostas

