I should write servlet that receive File from request. I want to store this file in local dir on the server. How can I do that? Thanks a lot :)
2 Answers
You can use fileUpload from apache found here.
7 Comments
Buhake Sindi
This won't help as the OP wants to download a file and not upload.
gred
If you mean to download it from your application then you can use the FileUpload to upload it and save it wherever and then there are plenty of articles and ways of how to download it. The Elite Gentleman indicates a fine article right here and here is another link: snippets.dzone.com/posts/show/4629
Don Roby
@The Elite Gentleman: It sounds like a file upload from the question.
gred
Nope!! In the FileServlet class the doGet method of @The Elite Gentleman's link, DOWNLOADS a file from the server. this link right here: balusc.blogspot.com/2007/07/… . Give it a try if you like.
Buhake Sindi
@Don Roby, the first time I read it, it sounded like he wants to get a file from an HTTP request. I reupdated my post.
|
BalusC wrote an excellent blog on FileServlet. This will help you.
Oops, the above-mentioned article shows you how to do file download, to do file upload, use the Apache FileUpload library instead.