Thanks for the source, but in Tomcat3.x my own code worked well ....
So, i dunno, what i've made wrong in Tomcat4 ... it's the same stuff
as ever .... :(

-----Ursprüngliche Nachricht-----
Von: Bongiorno.Christian [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 20. Dezember 2001 14:53
An: Tomcat Users List
Betreff: RE: File upload won't work with Tomcat4 ...


Here is the code I use for uploading... It's like 5 lines...Ok, I made
it a smidge more complicated -- this is the cool-kid version. You know,
"production quality"

Didn't mean to be a pain -- didn't feel like openning my IDE and logging
into the network

Chris


  private void upLoadZipFile(String zipFileName,HttpServletResponse
response)
  {
    byte[] data                   = null;
    try
    {
      ServletOutputStream stream    = response.getOutputStream();
      BufferedInputStream fromFile  = new BufferedInputStream(new
FileInputStream(this.pathToZips + zipFileName));

      response.setContentType("application/x-zip-compressed");
      response.setHeader("Content-Disposition", "attachment; filename="
+ zipFileName + ";");

      while(fromFile.available() > 0)
      {
        data = new byte[fromFile.available()];
        fromFile.read(data,0,fromFile.available());
        stream.write(data);
      }
    }
    catch(IOException e) {
      e.fillInStackTrace().printStackTrace();
    }
    finally {
      try {
        fromFile.close();
        stream.close();
      }
      catch(Exception exc) {
       exc.fillInStackTrace().printStackTrace();
      }
    }

  }





-----Original Message-----
From: martin eberle [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 8:49 AM
To: Tomcat Users List
Subject: AW: File upload won't work with Tomcat4 ...


hmmm, thx for the hint, but i've checked out google by nearly the same
keywords and websites in result .... ;)

i'm in position to think, it's any logical error in my code, not
caused by tomcat .. hmm .. anyway, thx for supporting me ... 

-martin

-----Ursprüngliche Nachricht-----
Von: Bongiorno.Christian [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 20. Dezember 2001 14:43
An: Tomcat Users List
Betreff: RE: File upload won't work with Tomcat4 ...


I sniffed around google for 10 minutes and came up with perfect and
simple code for this task.

Look under 
"java servlet http upload"



-----Original Message-----
From: martin eberle [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 20, 2001 3:42 AM
To: [EMAIL PROTECTED]
Subject: File upload won't work with Tomcat4 ...


Hi,

i try to upload any stuff (mostly .zip, .doc, .xls, .txt) - but it
doesn't matter which filetype, the result
is always the same:

Apache Tomcat/4.0.1 - HTTP Status 404 -
../webapps/mywebapp/data/attachements/61_7781091_win.ini (File not
found)
type Status report
message ../webapps/mywebapp/data/attachements/61_7781091_win.ini (File
not found)
description The requested resource
../webapps/mywebapp/data/attachements/61_7781091_win.ini (File not
found)) is not available.

I know, that the file has not been found, cause i try to create it ;)
... 

Tomcat directory structure to .jsp files (oh, directory / file user
rights, etc. has been set correctly!):
/var/tomcat4/webapps/mywebapp/

Tomcat directory structure to data (upload) files:
/var/tomcat4/webapps/mywebapp/data/attachements/

In my upload class, i've defined the var "SAVEPATH" which contain's the
store path as string ... :
String savePath="../webapps/mywebapp/data/attachements/";

Question 1:
>From which base directory does tomcat try to access the data dir?
(/var/tomcat4/bin/../webapps/mywebap/data/attachements/) ??...

Question 2:
Is my savePath definition just wrong?

What i'm wondering about: with Tomcat 3.2x, the fileupload worked as
well ....

Thx for any answers ...

Regards,
-martin

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to