Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Uploading Files using JspSmartUpload

843835May 23 2002 — edited May 23 2002
Hi,
I saw that many people have mentioned that JspSmartUpload works for them. So, here is my problem and i hope i will get an answer.
For me, JspSmartUpload seems to upload the file successfully. Unfortunately, it strips out few bytes of data. We primarily use it to upload JAR and ZIP files. Hence, when i try to open the uploaded file, WinZip reports that the file is corrupted. Has anyone faced this problem?

The OS is solaris 8. Code that i use is:

<%@ page buffer="16k"%>
<%@ page session="true"%>
<jsp:useBean id="myUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<%@ page errorPage="error.jsp" %>
<%
String url = "http://www.pingtel.com/appsubmissions/";
try{
myUpload.initialize(pageContext);
myUpload.setAllowedFilesList("jar,zip");

// Loads all the information submitted via the form into the myUpload object.
myUpload.upload();

/* Code to validate the form parameters */

com.jspsmart.upload.File myFile = myUpload.getFiles().getFile(0);
String uploadDir = "/export/test/" + myFile.getFileName().trim();
myFile.saveAs(uploadDir, myFile.SAVEAS_PHYSICAL);
}
catch(Exception e) { e.printStackTrace(); }

%>

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 20 2002
Added on May 23 2002
4 comments
640 views