My form allow users to upload 2 files, both to a different directories. When we create the MultipartRequest, we need to specific a location. And then, everything would go inside there. MultipartRequest m = new MultipartRequest (request, "e:/loc", 1024 * 1024); Is there anyway to go around this?
Well , what I feel here there is no way u can achieve this fuctionality without modifying the MultipartRequest.java file . So what u can do is inside the constructor of MultipartRequest file u can check for the file type or ur condition on which u want to put ur file in the respective directory and make the call to its other constructor which takes 2 parameters and can set the direcory also .
Try and Try Till u succeed<br /> <br />Sandeep Jain
Upload both files to a temporary holding directory, and just move them after they are uploaded.
There is a related question in the cos faq: [ August 10, 2002: Message edited by: Mike Curwen ]
Joined: Aug 09, 2002
Hi, Thanks for all the feedbacks. I managed to get in touch with the creater of the package. According to him, I have to use the MultipartParser instead if I want more controls. Else I have to do like what Mike pointed out, which is dumping the files to a temporary directory first. But personally, I would say that the 2nd solution is not that feasible because my code would be platform dependent then. Moving the files manually is a waste of effort, thus what I can think of is by using the Runtime class to move the files automatically. To do that, I have to invoke the OS command which is not the same for all platforms.
Mike's Solution is the one i addopted but unfortunatelly if the client press the stop button before the file is uploaded . then in your temp dir there will be some garbage and you have to include a Garbage colection schema .. Mike have yod had that problem ??