ASP component-less Upload? From Principle analysis to practice)

Source: Internet
Author: User
Day 5: get the file unit
What we want to do today is to get the file content in a more interesting way. In fact, let's look at the data we want to process and the processing of the text unit the day before yesterday.
To clearly distinguish between files and text units, we use ourRequest. file (index) to correspond to ourRequest. form (index) of text units ). Of course, because the information we need for files is different from the text, this time we will not get FormElement, but a new object FileElement.
The differences between the file unit and the text unit on the raw data are poor:
1. The first line has an additional filename = "xxx" module;
2. The second line is used to indicate contentType.
The target information is different. Therefore, the obtained object FileElement is different from the FormElement object:
1. The count attribute is not required (checkbox does not exist );
2. Item (index) is not required (same as above, checkbox does not exist );
3. A ContentType attribute is required;
4. A FilePath attribute is required;
5. A FileName attribute is required;
6. A Size attribute is required;
7. Because binary is required, there is no need to convert binary => strings;
8. Because binary is required, it is more appropriate to change the attribute Value to Data.
In addition, UploadRequest should also add the Files attribute, Form (index) method, and m_dicFiles members. Now, we will expand it:
A. UploadRequest (designed above, expanded here)
This class corresponds to the request object.
Attribute:
RawData obtains raw data to facilitate [read-only] check.
Forms returns a counter with the count attribute,
You can use outRequest. Forms. Count to obtain the number of text form fields [read-only].
Files Gets a counter with the count attribute,
You can use outRequest. Files. Count to obtain the number of file form fields [read-only].
Form (index) can be used to retrieve text form fields using numbers or text. It is similar to request. Form.
It returns a FormElement object.
File (index) can be used to retrieve the File form field using numbers or text. It returns a FileElement object.
B. FileElement
It can be seen as the embodiment of a single file domain. This class can be used to obtain detailed file information, such as name, data, path, filename, contentType, and size.
Attribute:
The Name of the file domain. Is xxx in <input type = file name = xxx>
The content of the Data file. Binary string
ContentType of the file field
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.