Solved

Upload 5 MB file from a JSP to UNIX box

Posted on 2004-10-01
3
306 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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