Hi Jeroen
Thanks for your help. It has solved the problem.
cheers
chinmay
wrote:
> Hi,
>
> The code you provided won't work because you're
> trying to open the file on
> the server using
> the path on the client (this will only work when
> you're connecting to
> localhost). The reason
> you get an file-not-found with 2.0.3 is that the
> upload package has changed
> and that FilePartFile
> doesn't implement the toString() method and this
> returns the classname and
> address.
>
> The correct way to read the uploaded file is by
> using:
>
>
((FilePart)request).get("upload_field").getInputStream()
>
> For a complete example see:
>
http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=101878098524370&w=2
>
> Jeroen
>
> ----- Original Message -----
> From: "ch ku" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, September 09, 2002 2:44 AM
> Subject: Re: Problem uploading an file from desktop.
> Is it a bug or I am
> implementing it incorrectly ?
>
>
> > Hi All
> >
> > Please help. Is this a bug with cocoon2.0.3 or am
> I
> > implementing it wrong way ?
> >
> > I am facing problem while uploading a file from
> > desktop.
> >
> > Here is xsl code.
> >
> > <form name="pg"
> > action="/cocoon/email_alert/Read.xml"
> > method="post" enctype="multipart/form-data">
> > <td class="settings2">
> > <input type="file" name="file_path"
> > class="white"/>
> > <input type="submit" name="file_action"
> > value="Add" class="white"/>
> > <input type="hidden" name="tt"
> value="tt"
> > />
> > </td>
> > </form>
> >
> > Here is portion of Read.xml
> >
> >
> >
> > if (!(request.getParameter("tt") == null)) {
> > faction = request.getParameter("Add");
> > val = request.getParameter("file_path");
> > try {
> > System.out.println("%%%%%%%%%%%");
> > FileInputStream n = new
> FileInputStream(val);
> > z = n.available();
> > if (z <![CDATA[>]]> 0) {
> > b = new byte[z];
> > }
> > n.read(b);
> > n_str = new String(b,"ISO8859_1");
> > }
> > catch(Exception e) {
> >
> > n_str = e.toString();
> > }
> > }
> > System.out.println("THEEEEE");
> > </xsp:logic>
> > <disp><xsp:expr>displayString</xsp:expr></disp>
> > <path><xsp:expr>n_str</xsp:expr></path>
> >
> >
> > For cocoon2.0.1 code works fine but with cocoon
> > 2.0.3
> > code throws an error
> >
> > java.io.FileNotFoundException:
> >
> >
>
org.apache.cocoon.components.request.multipart.FilePartFile@406eb6
> > (No such file or directory)
> >
> > Can anybody help me ?
> >
> > Thanks
> > chinmay
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Finance - Get real-time stock quotes
> > http://finance.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, email:
> [EMAIL PROTECTED]
> >
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, email:
> [EMAIL PROTECTED]
>
__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]