Full introduction to jspSmartUpload upload/download (III. File Upload)

Source: Internet
Author: User

Iii. File Upload

(I) Form requirements

There are two requirements for the FORM for uploading files:

1. Apply POST to METHOD, that is, METHOD = "POST ".

2. Add attributes: ENCTYPE = "multipart/form-data"

The following is an example of a FORM used to upload files:

     <Form method = "POST" ENCTYPE = "multipart/form-data" ACTION = "/jsp (preferred for SUN Enterprise Applications) SmartUpload/upload. jsp (preferred for SUN Enterprise Applications) "> <input type =" FILE "NAME =" MYFILE "> <input type =" SUBMIT "> </FORM>


(Ii) Upload example

1、upload page upload.html

This page provides a form that allows you to select the file to be uploaded and click "Upload" to upload the file.

The page source code is as follows:

     <! -- File name: upload.html Author: vertical and horizontal software production center Yu Yiqi (zhsoft88@sohu.com) --> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN"> 


2. Upload processing page do_upload.jsp (preferred for SUN Enterprise applications)

Upload files on this page. The page source code details the usage of the upload method, which will not be repeated here.

The page source code is as follows:

     <% -- File name: do_upload.jsp (preferred for SUN Enterprise Applications) Author: Landscape software production center Yu Yiqi (zhsoft88@sohu.com) -- %> <% @ page contentType = "text/html; charset = gb2312 "language =" java "import =" java. util. *, com. jsp (preferred for SUN Enterprise Applications) smart. upload. * "errorPage =" "%> 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.