[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tapestry-user
Subject:    Re: [Ext] Re: file upload doesn't set file value
From:       Dongmei Cao <dongmei.cao () icann ! org>
Date:       2017-12-14 19:55:36
Message-ID: 80539E91-CBDA-4762-8774-24BDDE695C07 () icann ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks for your example! Just for anyone who might run into to the same issue. It was \
the SpringBoot causing the issue for our case (we migrated to SpringBoot as we \
upgrade the Tapestry version). Had to specify a Multipart File Size in SpringBoot to \
have it work properly.

 

Dongmei

 

From: yazmin georgina quintal <geolita67@yahoo.com.mx>
Reply-To: yazmin georgina quintal <geolita67@yahoo.com.mx>
Date: Wednesday, December 13, 2017 at 6:38 AM
To: Tapestry users <users@tapestry.apache.org>, Dongmei Cao <dongmei.cao@icann.org>
Subject: Re: [Ext] Re: file upload doesn't set file value

 

Do not know SpringBoot.

 

I add my test page, but I do not see any difference with your, and my dependency is \
simply

 

        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-upload</artifactId>
            <version>5.4.3</version>
        </dependency>

 

On the browser, do you select the file to be send/post during your test ? I know, \
really simply but ... I though this because the required validation is probably been \
done on client side.

 

 

Saludos.

 

Atte. Yazmín Georgina Quintal Moo 

Local 63 y 64 de Plaza de la Tecnología. Villahermosa, Tab. 
Tel 993 1311688 
Cel. 9931 689207

 

 

El martes, 12 de diciembre de 2017 21:45:56 GMT-6, Dongmei Cao \
<dongmei.cao@icann.org> escribió: 

 

 

1) I have the following dependencies

<dependency>
    <groupId>org.apache.tapestry</groupId>
    <artifactId>tapestry-upload</artifactId>
    <version5.4.3version>
</dependency>

Tried with and without the following two. Didn't make any difference:

<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3.2</version>
</dependency>

<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.4</version>
</dependency>

2) Since I have the validate="required" in the .tml, it always display error message \
"You must provide a value for File". It didn't even get to the onSuccess(). If I \
remove the validate="required", it got to the onSuccess. But the file is null. So, \
yes, it throws NPE when trying file.getFileName().

3) I'm using it with SpringBoot. Not sure if that will make any difference.

Thanks,
Dongmei


From: yazmin georgina quintal <geolita67@yahoo.com.mx>
Reply-To: yazmin georgina quintal <geolita67@yahoo.com.mx>
Date: Tuesday, December 12, 2017 at 5:20 PM
To: Tapestry users <users@tapestry.apache.org>, Dongmei Cao <dongmei.cao@icann.org>
Subject: [Ext] Re: file upload doesn't set file value

I am using it and it is working ok:

1. Did you add depedency to tapestry-fileupload module ?.
2. Does it throws a Null Pointer Exception or simply you do not see then file created \
? 3. The path in "copied" File instance must exist, the method write will not create \
it.

I recently begun to use it without trouble.

Saludos.
Atte. Yazmín Georgina Quintal Moo 
Local 63 y 64 de Plaza de la Tecnología. Villahermosa, Tab. 
Tel 993 1311688 
Cel. 9931 689207


El martes, 12 de diciembre de 2017 18:37:49 GMT-6, Dongmei Cao \
<dongmei.cao@icann.org> escribió: 


Hi,

I know this is an old post. I'm trying to migrate our app from 5.3.8 to 5.4.3, and \
finding the file upload is no longer working. I'm not using t:zone at all. But the \
file value is always null. I see the JumpStart site \
(http://jumpstart.doublenegative.com.au/jumpstart/[jumpstart.doublenegative.com.au][jumpstart.doublenegative.com.au]) \
have the "File Upload" example disabled. Anyone has a working example. Could you \
please share? 



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


    @Persist
    @Property
    private UploadedFile file;

    public Object onSuccess() {
        System.out.println(file.getFileName());
        File copied = new File("/my/file/location/" + file.getFileName());
        file.write(copied);

        return this;
    }

Thanks,
Dongmei

On 9/1/16, 12:50 AM, "Chris Poulsen" <mailinglist@nesluop.dk> wrote:

    Unfortunately I think Carlos is correct.
    
    -- 
    Chris
    
    On Wed, Aug 31, 2016 at 11:18 PM, Pavel Chernyak <fjfalcon@fjfalcon.ru>
    wrote:
    
    > Hi there.
    >
    > Maybe you shall anotate field file @Persist?
    >
    >
    > On 31 August 2016 at 23:03, Qbyte Consulting <qbyteconsulting@gmail.com>
    > 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
    >
    


[Attachment #5 (text/html)]

<html xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"><head><meta name=Title content=""><meta \
name=Keywords content=""><meta http-equiv=Content-Type content="text/html; \
charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered \
medium)"><style><!-- /* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:DengXian;
	panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:"Helvetica Neue";
	panose-1:2 0 5 3 0 0 0 2 0 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
span.msoIns
	{mso-style-type:export-only;
	mso-style-name:"";
	text-decoration:underline;
	color:teal;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style></head><body bgcolor=white lang=EN-US link=blue vlink=purple><div \
class=WordSection1><p class=MsoNormal>Thanks for your example! Just for anyone who \
might run into to the same issue. It was the SpringBoot causing the issue for our \
case (we migrated to SpringBoot as we upgrade the Tapestry version). Had to specify a \
Multipart File Size in SpringBoot to have it work properly.<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Dongmei<o:p></o:p></p><p \
class=MsoNormal><o:p>&nbsp;</o:p></p><div style='border:none;border-top:solid #B5C4DF \
1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span \
style='font-size:12.0pt;color:black'>From: </span></b><span \
style='font-size:12.0pt;color:black'>yazmin georgina quintal \
&lt;geolita67@yahoo.com.mx&gt;<br><b>Reply-To: </b>yazmin georgina quintal \
&lt;geolita67@yahoo.com.mx&gt;<br><b>Date: </b>Wednesday, December 13, 2017 at 6:38 \
AM<br><b>To: </b>Tapestry users &lt;users@tapestry.apache.org&gt;, Dongmei Cao \
&lt;dongmei.cao@icann.org&gt;<br><b>Subject: </b>Re: [Ext] Re: file upload doesn't \
set file value<o:p></o:p></span></p></div><div><p \
class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica Neue",sans-serif'>Do not know \
SpringBoot.<o:p></o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica Neue",sans-serif'>I add my test page, \
but I do not see any difference with your, and my dependency is \
simply<o:p></o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica Neue",sans-serif'>&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp; &lt;dependency&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; &nbsp;&lt;groupId&gt;org.apache.tapestry&lt;/groupId&gt;<br>&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&lt;artifactId&gt;tapestry-upload&lt;/artifactId&gt;<br>&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&lt;version&gt;5.4.3&lt;/version&gt;<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; \
&nbsp;&lt;/dependency&gt;<o:p></o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica Neue",sans-serif'>On the browser, do \
you select the file to be send/post during your test ? I know, really simply but ... \
I though this because the required validation is probably been done on client \
side.<o:p></o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'>Saludos.<o:p></o:p></span></p><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica Neue",sans-serif'>Atte. Yazmín \
Georgina Quintal Moo <o:p></o:p></span></p></div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica Neue",sans-serif'>Local 63 y 64 de \
Plaza de la Tecnología. Villahermosa, Tab. <br>Tel 993 1311688 <br>Cel. 9931 \
689207<o:p></o:p></span></p></div></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div><p class=MsoNormal><span \
style='font-size:12.0pt;font-family:"Helvetica \
Neue",sans-serif'><o:p>&nbsp;</o:p></span></p></div><div \
id="yahoo_quoted_3490708795"><div><div><p class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Helvetica Neue",sans-serif;color:#26282A'>El \
martes, 12 de diciembre de 2017 21:45:56 GMT-6, Dongmei Cao \
&lt;dongmei.cao@icann.org&gt; escribió: <o:p></o:p></span></p></div><div><p \
class=MsoNormal><span style='font-size:10.0pt;font-family:"Helvetica \
Neue",sans-serif;color:#26282A'><o:p>&nbsp;</o:p></span></p></div><div><p \
class=MsoNormal><span style='font-size:10.0pt;font-family:"Helvetica \
Neue",sans-serif;color:#26282A'><o:p>&nbsp;</o:p></span></p></div><div><div><p \
class=MsoNormal><span style='font-size:10.0pt;font-family:"Helvetica \
Neue",sans-serif;color:#26282A'>1) I have the following \
dependencies<br><br>&lt;dependency&gt;<br>&nbsp; &nbsp; \
&lt;groupId&gt;org.apache.tapestry&lt;/groupId&gt;<br>&nbsp; &nbsp; \
&lt;artifactId&gt;tapestry-upload&lt;/artifactId&gt;<br>&nbsp; &nbsp; \
&lt;version5.4.3version&gt;<br>&lt;/dependency&gt;<br><br>Tried with and without the \
following two. Didn't make any difference:<br><br>&lt;dependency&gt;<br>&nbsp; &nbsp; \
&lt;groupId&gt;commons-fileupload&lt;/groupId&gt;<br>&nbsp; &nbsp; \
&lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;<br>&nbsp; &nbsp; \
&lt;version&gt;1.3.2&lt;/version&gt;<br>&lt;/dependency&gt;<br><br>&lt;dependency&gt;<br>&nbsp; \
&nbsp; &lt;groupId&gt;commons-io&lt;/groupId&gt;<br>&nbsp; &nbsp; \
&lt;artifactId&gt;commons-io&lt;/artifactId&gt;<br>&nbsp; &nbsp; \
&lt;version&gt;2.4&lt;/version&gt;<br>&lt;/dependency&gt;<br><br>2) Since I have the \
validate=&quot;required&quot; in the .tml, it always display error message "You must \
provide a value for File". It didn't even get to the onSuccess(). If I remove the \
validate=&quot;required&quot;, it got to the onSuccess. But the file is null. So, \
yes, it throws NPE when trying file.getFileName().<br><br>3) I'm using it with \
SpringBoot. Not sure if that will make any \
difference.<br><br>Thanks,<br>Dongmei<br><br><br>From: yazmin georgina quintal &lt;<a \
href="mailto:geolita67@yahoo.com.mx">geolita67@yahoo.com.mx</a>&gt;<br>Reply-To: \
yazmin georgina quintal &lt;<a \
href="mailto:geolita67@yahoo.com.mx">geolita67@yahoo.com.mx</a>&gt;<br>Date: Tuesday, \
December 12, 2017 at 5:20 PM<br>To: Tapestry users &lt;<a \
href="mailto:users@tapestry.apache.org">users@tapestry.apache.org</a>&gt;, Dongmei \
Cao &lt;<a href="mailto:dongmei.cao@icann.org">dongmei.cao@icann.org</a>&gt;<br>Subject: \
[Ext] Re: file upload doesn't set file value<br><br>I am using it and it is working \
ok:<br><br>1. Did you add depedency to tapestry-fileupload module ?.<br>2. Does it \
throws a Null Pointer Exception or simply you do not see then file created ?<br>3. \
The path in &quot;copied&quot; File instance must exist, the method write will not \
create it.<br><br>I recently begun to use it without \
trouble.<br><br>Saludos.<br>Atte. Yazmín Georgina Quintal Moo <br>Local 63 y 64 de \
Plaza de la Tecnología. Villahermosa, Tab. <br>Tel 993 1311688 <br>Cel. 9931 \
689207<br><br><br>El martes, 12 de diciembre de 2017 18:37:49 GMT-6, Dongmei Cao \
&lt;<a href="mailto:dongmei.cao@icann.org">dongmei.cao@icann.org</a>&gt; escribió: \
<br><br><br>Hi,<br><br>I know this is an old post. I'm trying to migrate our app from \
5.3.8 to 5.4.3, and finding the file upload is no longer working. I'm not using \
t:zone at all. But the file value is always null. I see the JumpStart site (<a \
href="https://urldefense.proofpoint.com/v2/url?u=http-3A__jumpstart.doublenegative.com \
.au_jumpstart_&amp;d=DwMFaQ&amp;c=FmY1u3PJp6wrcrwll3mSVzgfkbPSS6sJms7xcl4I5cM&amp;r=2z \
1riFMXKMf_hbDJyPHriu7_4_IwytJZgQJzCNqy_QY&amp;m=DugQdN_18mBr_zhiz9ftF7gXwnKLvxrvmztleDsgT6Q&amp;s=KY6h9cN8_vKemdQm_tByZlMDqY46OaJkhPlRe45B_TQ&amp;e=" \
target="_blank">http://jumpstart.doublenegative.com.au/jumpstart/[jumpstart.doublenegative.com.au]</a>[jumpstart.doublenegative.com.au]) \
have the "File Upload" example disabled. Anyone has a working example. Could you \
please share? <o:p></o:p></span></p><div id=yqtfd58749><p class=MsoNormal><span \
style='font-size:10.0pt;font-family:"Helvetica \
Neue",sans-serif;color:#26282A'><br><br>&lt;t:form&gt;<br>&nbsp; &nbsp; \
&lt;t:errors/&gt;<br>&nbsp; &nbsp; &lt;input t:type=&quot;upload&quot; \
t:id=&quot;file&quot; t:value=&quot;file&quot; validate=&quot;required&quot;/&gt; \
&lt;br/&gt;<br>&nbsp; &nbsp; &lt;input type=&quot;submit&quot; \
value=&quot;Upload&quot;/&gt;<br>&lt;/t:form&gt;<br><br><br>&nbsp; &nbsp; \
@Persist<br>&nbsp; &nbsp; @Property<br>&nbsp; &nbsp; private UploadedFile \
file;<br><br>&nbsp; &nbsp; public Object onSuccess() {<br>&nbsp; &nbsp; &nbsp; &nbsp; \
System.out.println(file.getFileName());<br>&nbsp; &nbsp; &nbsp; &nbsp; File copied = \
new File(&quot;/my/file/location/&quot; + file.getFileName());<br>&nbsp; &nbsp; \
&nbsp; &nbsp; file.write(copied);<br><br>&nbsp; &nbsp; &nbsp; &nbsp; return \
this;<br>&nbsp; &nbsp; }<br><br>Thanks,<br>Dongmei<br><br>On 9/1/16, 12:50 AM, \
&quot;Chris Poulsen&quot; &lt;<a \
href="mailto:mailinglist@nesluop.dk">mailinglist@nesluop.dk</a>&gt; \
wrote:<br><br>&nbsp; &nbsp; Unfortunately I think Carlos is correct.<br>&nbsp; &nbsp; \
<br>&nbsp; &nbsp; -- <br>&nbsp; &nbsp; Chris<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; On \
Wed, Aug 31, 2016 at 11:18 PM, Pavel Chernyak &lt;<a \
href="mailto:fjfalcon@fjfalcon.ru">fjfalcon@fjfalcon.ru</a>&gt;<br>&nbsp; &nbsp; \
wrote:<br>&nbsp; &nbsp; <br>&nbsp; &nbsp; &gt; Hi there.<br>&nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt; Maybe you shall anotate field file @Persist?<br>&nbsp; \
&nbsp; &gt;<br>&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt; On 31 August 2016 at 23:03, \
Qbyte Consulting &lt;<a \
href="mailto:qbyteconsulting@gmail.com">qbyteconsulting@gmail.com</a>&gt;<br>&nbsp; \
&nbsp; &gt; wrote:<br>&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt; &gt;<br>&nbsp; &nbsp; \
&gt; &gt; I'm always finding that file is null for file upload? If I submit \
the<br>&nbsp; &nbsp; &gt; form<br>&nbsp; &nbsp; &gt; &gt; without async=true then \
file value is set and it works.<br>&nbsp; &nbsp; &gt; &gt;<br>&nbsp; &nbsp; \
&gt;<br>&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; &gt; --<br>&nbsp; &nbsp; &gt; With best \
regards.<br>&nbsp; &nbsp; &gt; Pavel Chernyak<br>&nbsp; &nbsp; &gt;<br>&nbsp; &nbsp; \
<o:p></o:p></span></p></div></div></div></div></div></div></div></body></html>


["smime.p7s" (application/pkcs7-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic