Solved

Upload 5 MB file from a JSP to UNIX box

Posted on 2004-10-01
3
304 Views
Last Modified: 2010-04-01
Hi,

I want to upload a file from a JSP page and put it into a location onto the remote UNIX box.My applcation is deployed in the UNIX box only.

I'd prefer to use only those APIs provided by sun,and not any third party tools.Thanks

Please usggest.
0
Comment
Question by:vishrutsumit
3 Comments
 

Accepted Solution

by:
kheefatt earned 125 total points
ID: 12206107
You can use the MultipartRequest class written by Jason Hunter. Download the jar at http://www.servlets.com/cos/cos-05Nov2002.zip. Extract it and you'll get a filename cosjar.

There is lots of documentation on how to use these classes here:  
http://www.servlets.com/cos/index.html

Put cos.jar in your <application>\WEB-INF\lib\

1) Create an HTML form with upload button. Name it "upload.html":

<html>
<body>
<form action="uploadResult.jsp" method="post" enctype="multipart/form-data">
<input type="file" name=testfile>
<input type=submit>
</form>
</body>
</html>

2) Create another file called "uploadResult.jsp". Inside the file, put :

<%@ page import="com.oreilly.servlet.*" %>
<%
       MultipartRequest(request, "/home/screen/uploads/",10*1000000);
       out.write("Upload Successful");
%>

3) Before u run, create a directory called uploads. As for my case, screen is my login name and I created a directory called uploads under screen. 10*1000000 is where I limit my upload filesize to 10 mb only.

4) Run it and the file should be uploaded into the directory. This work under my UNIX box!

GOOD LUCK!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Stuck in Bootstrap WysiHtml Editor 3 43
nested if has else if 13 99
dao vs facade design patterns 2 29
batch vs regular insert in spring DAO 2 20
While it may be true that the internet is a place of possibilities, it is also a hostile environment lurking with many dangers. By clicking on the wrong link, trusting the wrong person or using a weak password, you are virtually inviting hackers to …
Adults who share images on social media aren’t the only ones who need to worry about their privacy. Our culture’s tendency to share every move and celebration affects the privacy of our children, too.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question