Jeroen ter Voorde 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.
>

Does it make sense to add this method? 2.0.3 should be backward 
compatible with 2.0.1

Vadim



>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
>>
>>    
>>




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

Reply via email to