• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Servlet-File-Upload

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
I want to upload until three PDF-Files from a Web-Formular on a network-drive.
After I pressed the search button of the web-formular, I want to choose one file (I have three search fields to upload until three files at the same time). After choosing, I want to press on submit and upload the files on the network-drive (every time the same directory). During saving, the files are to be zippt.
My problem is, how can I upload files with a web-formular? And how can I received the file-stream?
With my class, I�m be able to choose a file from my drive and save it (zipped) on an other. But it I dont know how I do this with a web-formular.
I hope someone understand my problem and help me.
thxalot
Final =)
My Sourcecode to read and zipped a file:
import java.io.*;
import java.util.zip.*;
public class Zippen {
public static void main(String[] args) {

try {

ZipOutputStream out = new ZipOutputStream(new FileOutputStream("C://Java/test.zip"));
byte[] buf = new byte[4096];
int len;
FileInputStream in = new FileInputStream("C://files//readinfiles//testfile.pdf");
out.putNextEntry(new ZipEntry("outtestfile.pdf"));
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
in.close();
} catch (IOException e) {
System.err.println(e.toString());
}
}
}
 
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to send the form using "multipart/form-data" for one thing.
check out http://www.servlets.com/cos/index.html for a file upload library.
 
Final Desire
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot, I will try it.
Final =)
 
Everybody's invited. Even this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic