Hello,
I've been trying since this morning to use the "jakarta apache" upload file.
I could very easely upload file on my server, change the file name and path, however, I really don't understant how to directly write the file on the disk, the basic example
http://jakarta.apache.org/commons/fileupload/using.html shows how to upload using the file kept in memory.
but
now it's 3 hours that I'm trying to understand how to setup the max memory size and use the alternative way to write the file directly on the disk, of course, it was easy to set the size :
upload.setSizeThreshold(maxMemorySize);
but all I get is a servlet exeption telling me that the file is too large.
of course I know that, but how can I do something about is ?
i mean
if (item.isInMemory() ){ // the file size is under my "maxMemorySize"
// do the regular file upload from memory
// easy, I just followed the example in jakarta website
}
else {
// my file is too large, I cannot overload the server, need to write on the temp folder ( defined with setRepositoryPath("/tmp/");
// how can I do that ??
// I can understand some javaDoc, but I'm not an engeneer, really need some sample code to see how it's working
}
If anyone could give me a link to a more precise sample page than on the jakarta help files...
really frustrating to only have
// Process a file upload
if (writeToFile) {
File uploadedFile = new File(...);
item.write(uploadedFile);
}
// that is so easy !!
else {
InputStream uploadedStream = item.getInputStream();
...
uploadedStream.close();
}
what to do instead of the " ... " ???
thanks for your support (and please forgive my frenchie english)