Difference between revisions of "Uploading a file"

From MyWiki
Jump to: navigation, search
Line 1: Line 1:
 
'''Reference:'''  https://www.tutorialspoint.com/jsp/jsp_file_uploading.htm<br>
 
'''Reference:'''  https://www.tutorialspoint.com/jsp/jsp_file_uploading.htm<br>
 
Needs commons-fileupload.x.x.jar and commons-io-x.x.jar    download from https://commons.apache.org/fileupload/ and  https://commons.apache.org/io/
 
Needs commons-fileupload.x.x.jar and commons-io-x.x.jar    download from https://commons.apache.org/fileupload/ and  https://commons.apache.org/io/
Make sure the target directories are created
+
Make sure the target directories are created<br>
 +
 
 +
The upload form
 +
<source lang="java">
 +
<html>
 +
  <head>
 +
      <title>File Uploading Form</title>
 +
  </head>
 +
 
 +
  <body>
 +
      <h3>File Upload:</h3>
 +
      Select a file to upload: <br />
 +
      <form action = "UploadServlet" method = "post"
 +
        enctype = "multipart/form-data">
 +
        <input type = "file" name = "file" size = "50" />
 +
        <br />
 +
        <input type = "submit" value = "Upload File" />
 +
      </form>
 +
  </body>
 +
 
 +
</html>
 +
</source>

Revision as of 09:03, 29 August 2023

Reference: https://www.tutorialspoint.com/jsp/jsp_file_uploading.htm
Needs commons-fileupload.x.x.jar and commons-io-x.x.jar download from https://commons.apache.org/fileupload/ and https://commons.apache.org/io/ Make sure the target directories are created

The upload form

<html>
   <head>
      <title>File Uploading Form</title>
   </head>
 
   <body>
      <h3>File Upload:</h3>
      Select a file to upload: <br />
      <form action = "UploadServlet" method = "post"
         enctype = "multipart/form-data">
         <input type = "file" name = "file" size = "50" />
         <br />
         <input type = "submit" value = "Upload File" />
      </form>
   </body>
 
</html>