tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kemp Randy-W18971 <Randy.L.K...@motorola.com>
Subject Tomcat and jspsmartupload -- getparameter doesn't work
Date Thu, 01 Aug 2002 13:11:24 GMT
Has 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. 
--------------------------------------------------------------------------------------------------------------------------------
          
 <<...OLE_Obj...>> 
Bottom of Form 1

         ------> test1.html <----------------
<HTML>
<script LANGUAGE="JavaScript">
// Begin
function file1Value(thisvalue) {
  thisvalue.form.file1name.value = thisvalue.form.FILE1.value.toString();
  return true;
}

//  End -->
</script>

<BODY BGCOLOR="white">

<H1>jspSmartUpload : Sample 1</H1>
<HR>

<FORM METHOD="POST" ACTION="/jspsmartupload/jsp/test1.jsp" ENCTYPE="multipart/form-data">
   <INPUT type="text" name="filename"><BR>
   <INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR>
   <INPUT TYPE="FILE" NAME="FILE2" SIZE="50"><BR>
   <INPUT TYPE="FILE" NAME="FILE3" SIZE="50"><BR>
   <INPUT TYPE="FILE" NAME="FILE4" SIZE="50"><BR>
   <INPUT TYPE="SUBMIT" VALUE="Upload"><BR>
</FORM>

</BODY>
</HTML>
--------------------------------------------------------------------------------------------------------------------------------
              ----------------> 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" />

<HTML>
<BODY BGCOLOR="white">
<H1>jspSmartUpload : Sample 1</H1>
<HR>
<%

	// Variables
	int count=0;

	// Initialization
	mySmartUpload.initialize(pageContext);

	mySmartUpload.setTotalMaxFileSize(1000000);

	// Upload
	mySmartUpload.upload();
	out.println("File 1 is: " + mySmartUpload.getRequest().getParameter("filename") + "<br>");

	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());
	}



%>

</BODY>
</HTML>
--------------------------------------------------------------------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message