JSP File Upload component: Smartupload

Source: Internet
Author: User
Tags file upload html form

Pictures and other files upload is different from simple numbers, files in the computer in the form of binary, file upload to use the Smartupload components. Let's learn how to use the Smartupload component to upload files.

Smartupload Introduction

Smartupload is a www.jspsmart.com Web site developed a set of upload components package, can facilitate the implementation of file upload and download functions, smartupload components used is very simple, you can upload file types of restrictions, can easily get the name of the uploaded file, suffix, size and so on.

The smartupload itself is a system-supplied jar package (and the principle of importing the package as a database operation), where the user directly places the packet under Classpath or directly into the Tomcat_homelib directory.

Note: There are a lot of files uploaded, Smartupload is just one of them, but the www.jspsmart.com website that provides this component has been shut down, but until today Smartupload has been widely used until now because it's easy to use.

Example to explain the application of Smartupload component uploading files

This example will upload a picture on my desktop named Dahai.jpg to the folder upload.

Use this component to upload, in the upload when there is one thing to note is that you have to choose a good file to upload is which, this choice is definitely by the HTML form to complete.

Because the file is to be uploaded, the form must be encapsulated, because it is no longer normal text data, and the form's encapsulation is done by enctype.

smart_01.html     

Here's what to note:

1. Due to the fact that the uploaded files are generally relatively large, method uses post instead of get because get is limited by the length of the address bar.

2.enctype= "Multipart/form-data" said will be submitted in the form of binary, because the pictures and other documents are not pure numbers, but binary form of the file.

Now that the form has been completed, the upload can be done via smartupload. Before uploading, do the following steps:

1. Create a upload folder to hold the uploaded items (picture dahai.jpg). This folder is created in MyEclipse as shown in the following illustration:

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.