Folks,
I'm using commons-fileupload-1.2.jar in a Tomcat (v.4.0) JSP to upload a file.
After attempting to upload a file size 650 MB (iso image), the transfer halts
around 262MB. I tried changing the Tomcat -Xmx and -Xms startup flags, but this
didn't not make a difference. Calling FileUpload.getSizeMax() returns '-1', so
there's no limitation there. The page I've written is similar to what follows
here (taken from
http://wiki.apache.org/jakarta-commons/Net/FrequentlyAskedQuestions and
http://jakarta.apache.org/commons/fileupload/streaming.html). What ends up
happening is that the Tomcat java process terminates without reporting a
backtrace, and the log file does not reflect what happened. Any ideas?
Thanks,
OSCAR
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload();
// Parse the request
FileItemIterator iter = upload.getItemIterator(request);
while (iter.hasNext()) {
FileItemStream item = iter.next();
String name = item.getFieldName();
InputStream stream = item.openStream();
if (item.isFormField()) {
System.out.println("Form field " + name + " with value "
+ Streams.asString(stream) + " detected.");
} else {
System.out.println("File field " + name + " with file name "
+ item.getName() + " detected.");
FTPClient client = new FTPClient();
client.addProtocolCommandListener(new PrintCommandListener(new
PrintWriter(System.out)));
client.connect("127.0.0.1");
client.login("rory", "rory");
for (FTPFile file : client.listFiles()) {
System.out.printf("%s %s [%d bytes]\n"
,(file.isDirectory() ? "[D]" : " "),
file.getName(), file.getSize());
}
client.enterLocalPassiveMode();
client.setFileType(FTPClient.BINARY_FILE_TYPE);
// Upload a file
InputStream fis = stream;
OutputStream os = client.storeFileStream("myfile");
byte buf[] = new byte[8192];
int bytesRead = fis.read(buf);
while (bytesRead != -1) {
os.write(buf, 0, bytesRead);
bytesRead = fis.read(buf);
}
fis.close();
os.close();
client.completePendingCommand();
client.logout();
client.disconnect();
....
--
We've Got Your Name at http://www.mail.com!
Get a FREE E-mail Account Today - Choose From 100+ Domains
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]