Upload files using ASP and VBScript (1)

Source: Internet
Author: User
Tags file upload
Uploading files from a browser is an easy way to transfer files from a client to the server. Since the third-generation browsers Netscape and Microsoft, most browsers can upload files to the server without providing users with special access methods or software.
    
Some ASP components are designed for file upload, for example:
Posting Acceptor
(Part of Microsoft SiteServer ),
AspSmartUpload (Advantys ),
AspUpload (PersistsSoftware ),
SA-FileUpSoftware Artisants)
    
The beginning of this article will show you information about creating such components, which usually use VB, C ++, or Java.
    
The problem with these components is that they are part of a third-party product rather than a non-standard ASP. As a third-party component, it must be installed on the server. This means that the DLL must be copied and registered on the server. Most host systems do not allow such settings on their servers, because configuration problems (especially virtual hosts) may occur ). The second disadvantage is that most of them are not free. If the source code is not provided, they cannot be customized as needed.
    
Therefore, I need to write VBScript code to solve the file upload problem. This is not an inevitable choice, because VBScript is a scripting language that can only use the variants data type, and does not provide many built-in functions to manage binary data and byte arrays.
    
To understand the upload process, you must first know how data is sent to the server from the browser over HTTP. This means to understand the form submission of "multipart/form-data" (multipart/format-data.
    
Upload form
    
Generally, HTML forms are used to transmit data from a browser to the server. This form may contain text fields, check boxes, buttons, and file type control for uploaded files. The user fills in the data and submits the table to the server.
    
The enctype attribute in the form element specifies the content type of the table dataset code passed to the server. The default value of the enctype attribute is "application/x-www-form-urlencoded". However, when sending a large amount of text, data containing non-ASCII characters or binary numbers to the server, this default type cannot be used. In this case, the "multipart/form-data" content type should be used when submitting a file upload form.
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.