On Fri, 10 Jun 2011 01:22:05 -0300, ael <alan-lua...@dash.com.ph> wrote:

What do you mean i should use the Upload component?

Oops, my mail reader somehow hadn't shown the Upload component being used, just an empty form. :P

<t:form t:id="guestForm">
        <t:errors/>
        <input t:type="upload" t:id="file" validate="required"/>
        <br/>
        <input type="submit" value="Upload"/>
</t:form>

public class UploadExample
    {
        @Property
        private UploadedFile file;

        @Component(id = "guestForm")
        private Form guestForm;

        public void onSuccessFromguestForm()
        {
            File copied = new File("/my/file/location/" +
file.getFileName());
           file.write(copied);
        }
    }

Your code seems fine besides the fact it doesn't check if file is null, something that happens when the user doesn't select a file to upload.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to