jspsmartupload and tomcat
randykemp Aug 1, 2002 10:28 AMHas anyone used Tomcat with jspsmartupload? I have a question about using jspsmartupload with Tomcat 4.0.4 in development and having the jspsmartupload getparameter work. I have created a jar file with all the jspsmartupload components and put it into the Tomcat lib directory. I then created two small JSP pages. Now the upload works perfectly, but the text fields returns a null on trying to parse it. Please look at the simple code below if you have used both products, and tell me what I am doing wrong.
--------------------------------------------------------------------------------------------------------------------------------
-------> test1.html - I enter the following <--------------------
1. Word test in first text box
2. Browse to file d:/zipped/answer.txt
--------------------------------------------------------------------------------------------------------------------------------
----------> I go to test1.jsp and get the following results
jspSmartUpload : Sample 1
File 1 is: null
1 file(s) uploaded.
--------------------------------------------------------------------------------------------------------------------------------
Bottom of Form 1
------> test1.html <----------------
// Begin
function file1Value(thisvalue) {
thisvalue.form.file1name.value = thisvalue.form.FILE1.value.toString();
return true;
}
// End -->
<H1>jspSmartUpload : Sample 1</H1>
--------------------------------------------------------------------------------------------------------------------------------
----------------> test1.jsp <--------------------------------
<%@ page language="java" import="com.jspsmart.upload.*, java.util.*, com.oreilly.servlet.multipart.* "%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<H1>jspSmartUpload : Sample 1</H1>
<%
// Variables
int count=0;
// Initialization
mySmartUpload.initialize(pageContext);
mySmartUpload.setTotalMaxFileSize(1000000);
// Upload
mySmartUpload.upload();
out.println("File 1 is: " + mySmartUpload.getRequest().getParameter("filename") + "");
try {
// Save the files with their original names in the virtual path "/upload"
// if it doesn't exist try to save in the physical path "/upload"
count = mySmartUpload.save("D:/zipped/upfilessmart");
// Save the files with their original names in the virtual path "/upload"
// count = mySmartUpload.save("/upload", mySmartUpload.SAVE_VIRTUAL);
// Display the number of files uploaded
out.println(count + " file(s) uploaded.");
} catch (Exception e) {
out.println(e.toString());
}
%>
--------------------------------------------------------------------------------------------------------------------------------