ASP no component upload? From the principle analysis to practice (Part I)

Source: Internet
Author: User
Day Seventh: Implementing additional functionality
Today, we are going to implement the methods and attributes proposed yesterday to refine our file upload class. A performance problem that has not been paid much attention to before, and this time to be completely resolved:
1. All variables are declared first and then used;
2. Set the Teminate method of the class;
3. Simplify the wording of some places and pay attention to details.
Our principle is to achieve first, after optimization. Of course, such things as variable declarations, if the program is large, it is best to write the program once. If it's finished, you can add Option Explicit (force variable declaration) at the beginning of the page, and then test all the methods and properties until there is no error.
In addition, the exception code we also tidy up:
Code class name Type description
==============================================================================
One formelement indexoutofbound form element subset index bounds
FormElement illegalargument Illegal FORM element subset index
Uploadrequest indexoutofbound text element index out of bounds
Uploadrequest illegalargument Illegal text element index
Uploadrequest indexoutofbound file Element index out of bounds
Uploadrequest nullref file Element index does not exist
Uploadrequest illegalargument Illegal FORM element index
Uploadrequest toolargefile file%fldname size is too large
Uploadrequest toolargefiles file Total size is too large
Uploadrequest invalidfiletype file%fldname type error
Well, here's the whole realization:
1. Com.2yup.util.uploadrequest.class
<%
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' No copyright, welcome to copy or for commercial use.
' If you want to reprint, can indicate the best source, we will be very grateful to your support; if inconvenient, even if, hehe.
' Thank you often to 2yup of netizens (many names, not write, hehe) long-term enthusiastic support,
' You are my enduring power.
'
' Detailed information about this component, and the whole process of programming, can be
' Http://www.2yup.com/asp
' Document Center to see what's going on. Have any questions, welcome to our forum discussion, or send me an email:
' Miles2yup@hotmail.com
'----Miles [Yup Studio] ^ ^
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'=========================================================================
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.