You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Borko Djurovic <dj...@gmail.com> on 2012/03/23 20:22:43 UTC

Upload file problem

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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Upload file problem

Posted by Bob Harner <bo...@gmail.com>.
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 <la...@googlemail.com> 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 <ta...@gmail.com>
> 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: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apa

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


Re: Upload file problem

Posted by Lance Java <la...@googlemail.com>.
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 <ta...@gmail.com>
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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apa

Re: Upload file problem

Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


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