If you click on the link I've provided you will see the code. I've copied the
code from there. This is from my Upload.html and formSubmit is as below:

    private IUploadFile file;
    private File serverFile;

    public IUploadFile getFile() { return file; }

    public void setFile(IUploadFile value) {
        file = value;
    }
    public void formSubmit(IRequestCycle cycle) { 
        InputStream fis = file.getStream(); 
        FileOutputStream fos = null;
         
        try { 
            fos = new FileOutputStream(new  File(file.getFileName()));
            byte[] buffer = new byte[1024];  
            while (true) {            
                int length = fis.read(buffer);  
                if (length <  0) {
                    break;
                }
                fos.write(buffer, 0, length);               
            }
            fis.close();
            fos.close();
            serverFile = new File(file.getFileName());

        } catch (IOException ioe) {
            ioe.printStackTrace();            
        } finally {
            if (fis != null) {
                try { fis.close(); } catch (IOException ioe) {}
            }   
            if (fos != null) {
                try { fos.close(); } catch (IOException ioe) {}
            }
        }
    }


Nick Westgate wrote:
> 
> Ok. Is this in a page or a component?
> And your Java code? Do you have a formSubmit listener?
> 
> Cheers,
> Nick.
> 
> 
> Nazmul Bhuiyan wrote:
>> I've copied the code from
>> http://tapestry.apache.org/tapestry3/doc/ComponentReference/Upload.html
>> 
>> <form jwcid="@Form" listener="ognl:listeners.formSubmit">
>> <table bgcolor="#c0c0c0" cellpadding="4">
>>      <tr>
>>              <td colspan="2">File:&nbsp;<input jwcid="@Upload" 
>> file="ognl:file"
>> type="file"></input></td>
>>      </tr>
>>      <tr>
>>              <td colspan="2"><input type="submit" 
>> value="Upload"></input></td>
>>      </tr>
>> 
>> 
>> Thanks
>> 
>> Naz
>> 
>> 
>> Nick Westgate wrote:
>>> Please post the (relevant parts of) the code.
>>>
>>> Cheers,
>>> Nick.
>>>
>>>
>>> Nazmul Bhuiyan wrote:
>>>> I'm getting an error when trying the Upload component example in
>>>> http://tapestry.apache.org/tapestry3/doc/ComponentReference/Upload.html.
>>>>
>>>> Unable to resolve expression 'listeners.formSubmit' for
>>>> [EMAIL PROTECTED] 
>>>> binding: ExpressionBinding[UploadPage listeners.formSubmit
>>>> cachedValue=null] 
>>>>
>>>> I've modified the listener.formSubmit to listeners.formSubmit according
>>>> to
>>>> Nick and still getting the error.
>>>>
>>>> Nick's answer for same issue in this forum:
>>>> http://www.nabble.com/Form-upload-and-download-tf2236396.html#a6201542
>>>>
>>>> Is there anything missed?
>>>>
>>>> Thanks
>>>>
>>>> Naz
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T3%3A-Upload-tf4531396.html#a12934608
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to