file upload doesn't set file value

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

file upload doesn't set file value

Qbyte Consulting
Hi,

I'm always finding that file is null for file upload? If I submit the form
without async=true then file value is set and it works.

            <t:zone t:id="profileZone">

                <form t:type="form" t:id="uploadForm" async="true">
                    <t:errors/>
                    <input t:type="upload" t:id="file" t:value="file"
validate="required"/>
                    <input t:type="submit" value="Upload"/>
                </form>

    public void onValidateFromUploadForm() {
        if (file != null) {
            File copied = new File("./uploads/" + file.getFileName());
            file.write(copied);
         } else {
             System.out.println("upload failed");
        }
    }
Reply | Threaded
Open this post in threaded view
|

Re: file upload doesn't set file value

Carlos Montero Canabal
For my experience, FileUpload doesn´t support ajax form (t:async="true" or t:zone=“^”).

Regards

Carlos Montero

> El 31/8/2016, a las 22:03, Qbyte Consulting <[hidden email]> escribió:
>
> Hi,
>
> I'm always finding that file is null for file upload? If I submit the form
> without async=true then file value is set and it works.
>
>            <t:zone t:id="profileZone">
>
>                <form t:type="form" t:id="uploadForm" async="true">
>                    <t:errors/>
>                    <input t:type="upload" t:id="file" t:value="file"
> validate="required"/>
>                    <input t:type="submit" value="Upload"/>
>                </form>
>
>    public void onValidateFromUploadForm() {
>        if (file != null) {
>            File copied = new File("./uploads/" + file.getFileName());
>            file.write(copied);
>         } else {
>             System.out.println("upload failed");
>        }
>    }


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: file upload doesn't set file value

Pavel Chernyak
In reply to this post by Qbyte Consulting
Hi there.

Maybe you shall anotate field file @Persist?


On 31 August 2016 at 23:03, Qbyte Consulting <[hidden email]>
wrote:

>
> I'm always finding that file is null for file upload? If I submit the form
> without async=true then file value is set and it works.
>


--
With best regards.
Pavel Chernyak
Reply | Threaded
Open this post in threaded view
|

Re: file upload doesn't set file value

Chris Poulsen
Unfortunately I think Carlos is correct.

--
Chris

On Wed, Aug 31, 2016 at 11:18 PM, Pavel Chernyak <[hidden email]>
wrote:

> Hi there.
>
> Maybe you shall anotate field file @Persist?
>
>
> On 31 August 2016 at 23:03, Qbyte Consulting <[hidden email]>
> wrote:
>
> >
> > I'm always finding that file is null for file upload? If I submit the
> form
> > without async=true then file value is set and it works.
> >
>
>
> --
> With best regards.
> Pavel Chernyak
>