Check:
1) your filter is correct
2) your action should look like the action in the example file (I
honestly have no idea what these really do, but they look awfully
important):
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.getExternalContext().getApplicationMap().put("fileupload_bytes",
_upFile.getBytes());
facesContext.getExternalContext().getApplicationMap().put("fileupload_type",
_upFile.getContentType());
facesContext.getExternalContext().getApplicationMap().put("fileupload_name",
_upFile.getName());
On 4/28/05, Kostas Karadamoglou <[EMAIL PROTECTED]> wrote:
> 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
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>
> >>
>
>