Quantcast

Upload file problem

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

Upload file problem

Borko Djurovic
I have simple page that contains upload component. When I provide file for upload and submit the form, validation can't pass.

This is part of Index.tml page:
        <t:form t:id="upload" t:zone="displayZone">
                <t:errors/>
                                                                                                                                                                                                                               
<p>File Path: </p><input t:type="upload" t:id="fileUpload" t:value="file" validate="required" />
<input type="submit" value="Upload" />
        </t:form>
------------------------

This is Index.java page:
public class Index {

        @Property
        private UploadedFile file;

        @Property
        @InjectComponent
        private Zone displayZone;

        @Persist
        private IUnZiper unZiper;

        @SetupRender
        public void initialize() {
                unZiper = new UnZiper();
        }

        @Property
        private String currentFilePath;

        public List<String> fileList() {
                if (unZiper.isUnziped()) {
                        File outFile = new File(UnZiper.OUTPUT_FOLDER);
                        List<String> result = new ArrayList<String>();
                        for (String s : outFile.list()) {
                                result.add(s);
                        }
                        return result;
                }
                return null;
        }

        public Object onSuccess() {
                System.out.println("Hello: " + file.getFileName());
                unZiper.unzip(new File(file.getFileName()));
                return displayZone.getBody();
        }
}
-----------------
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Upload file problem

Taha Hafeez
Hi

File upload component does not work with ajax.  

regards
Taha

On Mar 24, 2012, at 12:52 AM, Borko Djurovic wrote:

> I have simple page that contains upload component. When I provide file for
> upload and submit the form, validation can't pass.
>
> This is part of Index.tml page:
> <t:form t:id="upload" t:zone="displayZone">
> <t:errors/>
> <table>
> <tr>
> <td><p>File Path: </p></td>
> <td><input t:type="upload" t:id="fileUpload" t:value="file"
> validate="required" /></td>
> </tr>
> <tr>
> <td><input type="submit" value="Upload" /></td>
> </tr>
> </table>
> </t:form>
> ------------------------
>
> This is Index.java page:
> public class Index {
>
> @Property
> private UploadedFile file;
>
> @Property
> @InjectComponent
> private Zone displayZone;
>
> @Persist
> private IUnZiper unZiper;
>
> @SetupRender
> public void initialize() {
> unZiper = new UnZiper();
> }
>
> @Property
> private String currentFilePath;
>
> public List<String> fileList() {
> if (unZiper.isUnziped()) {
> File outFile = new File(UnZiper.OUTPUT_FOLDER);
> List<String> result = new ArrayList<String>();
> for (String s : outFile.list()) {
> result.add(s);
> }
> return result;
> }
> return null;
> }
>
> public Object onSuccess() {
> System.out.println("Hello: " + file.getFileName());
> unZiper.unzip(new File(file.getFileName()));
> return displayZone.getBody();
> }
> }
> -----------------
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Upload-file-problem-tp5590513p5590513.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Upload file problem

Lance Java
Is ajax support for file upload on Tapestry's roadmap? It's easy enough to
implement by posting the form to a hidden iframe.

On Saturday, 24 March 2012, Taha Hafeez Siddiqi <[hidden email]>
wrote:

> Hi
>
> File upload component does not work with ajax.
>
> regards
> Taha
>
> On Mar 24, 2012, at 12:52 AM, Borko Djurovic wrote:
>
>> I have simple page that contains upload component. When I provide file
for
>> upload and submit the form, validation can't pass.
>>
>> This is part of Index.tml page:
>>       <t:form t:id="upload" t:zone="displayZone">
>>               <t:errors/>
>>               <table>
>>                       <tr>
>>                               <td><p>File Path: </p></td>
>>                               <td><input t:type="upload"
t:id="fileUpload" t:value="file"
>> validate="required" /></td>
>>                       </tr>
>>                       <tr>
>>                               <td><input type="submit" value="Upload"
/></td>

>>                       </tr>
>>               </table>
>>       </t:form>
>> ------------------------
>>
>> This is Index.java page:
>> public class Index {
>>
>>       @Property
>>       private UploadedFile file;
>>
>>       @Property
>>       @InjectComponent
>>       private Zone displayZone;
>>
>>       @Persist
>>       private IUnZiper unZiper;
>>
>>       @SetupRender
>>       public void initialize() {
>>               unZiper = new UnZiper();
>>       }
>>
>>       @Property
>>       private String currentFilePath;
>>
>>       public List<String> fileList() {
>>               if (unZiper.isUnziped()) {
>>                       File outFile = new File(UnZiper.OUTPUT_FOLDER);
>>                       List<String> result = new ArrayList<String>();
>>                       for (String s : outFile.list()) {
>>                               result.add(s);
>>                       }
>>                       return result;
>>               }
>>               return null;
>>       }
>>
>>       public Object onSuccess() {
>>               System.out.println("Hello: " + file.getFileName());
>>               unZiper.unzip(new File(file.getFileName()));
>>               return displayZone.getBody();
>>       }
>> }
>> -----------------
>>
>> --
>> View this message in context:
http://tapestry.1045711.n5.nabble.com/Upload-file-problem-tp5590513p5590513.html

>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Upload file problem

bobharner
https://github.com/valums/file-uploader is widely thought of as the
best ajax file upload implementation, and there are two Tapestry
integrations that I know of:

1) Taha's https://github.com/tawus/tawus/tree/master/tawus-ajaxupload

2) http://tapestry5-jquery.com/components/docsajaxupload

The Valums library is GPL/LGPL licensed, which is an impediment to
including it in Apache products.

On Mon, Mar 26, 2012 at 3:53 AM, Lance Java <[hidden email]> wrote:

> Is ajax support for file upload on Tapestry's roadmap? It's easy enough to
> implement by posting the form to a hidden iframe.
>
> On Saturday, 24 March 2012, Taha Hafeez Siddiqi <[hidden email]>
> wrote:
>> Hi
>>
>> File upload component does not work with ajax.
>>
>> regards
>> Taha
>>
>> On Mar 24, 2012, at 12:52 AM, Borko Djurovic wrote:
>>
>>> I have simple page that contains upload component. When I provide file
> for
>>> upload and submit the form, validation can't pass.
>>>
>>> This is part of Index.tml page:
>>>       <t:form t:id="upload" t:zone="displayZone">
>>>               <t:errors/>
>>>               <table>
>>>                       <tr>
>>>                               <td><p>File Path: </p></td>
>>>                               <td><input t:type="upload"
> t:id="fileUpload" t:value="file"
>>> validate="required" /></td>
>>>                       </tr>
>>>                       <tr>
>>>                               <td><input type="submit" value="Upload"
> /></td>
>>>                       </tr>
>>>               </table>
>>>       </t:form>
>>> ------------------------
>>>
>>> This is Index.java page:
>>> public class Index {
>>>
>>>       @Property
>>>       private UploadedFile file;
>>>
>>>       @Property
>>>       @InjectComponent
>>>       private Zone displayZone;
>>>
>>>       @Persist
>>>       private IUnZiper unZiper;
>>>
>>>       @SetupRender
>>>       public void initialize() {
>>>               unZiper = new UnZiper();
>>>       }
>>>
>>>       @Property
>>>       private String currentFilePath;
>>>
>>>       public List<String> fileList() {
>>>               if (unZiper.isUnziped()) {
>>>                       File outFile = new File(UnZiper.OUTPUT_FOLDER);
>>>                       List<String> result = new ArrayList<String>();
>>>                       for (String s : outFile.list()) {
>>>                               result.add(s);
>>>                       }
>>>                       return result;
>>>               }
>>>               return null;
>>>       }
>>>
>>>       public Object onSuccess() {
>>>               System.out.println("Hello: " + file.getFileName());
>>>               unZiper.unzip(new File(file.getFileName()));
>>>               return displayZone.getBody();
>>>       }
>>> }
>>> -----------------
>>>
>>> --
>>> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Upload-file-problem-tp5590513p5590513.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...