Asp is not afraid to upload Class 2.2. When uploading files, you can use Request. QueryString to pass the parameters to the Save page. querystring

Source: Internet
Author: User

Asp is not afraid to upload Class 2.2. When uploading files, you can use Request. QueryString to pass the parameters to the Save page. querystring

First turn a text paragraph, right?

In the background asp program, it is very easy to obtain the ASCII data submitted by the form in the past. However, to obtain the uploaded file, you must use the BinaryRead method of the Request object. The BinaryRead method reads the specified number of bytes of the current input stream in binary format. It is worth noting that once the BinaryRead method is used, the Request. Form or Request. QueryString set cannot be used any more. Combined with the TotalBytes attribute of the Request object, all the data submitted by the form can be converted to binary, but the data is encoded.

It seems that it is not all right. The blue font seems to have a problem here. When uploading a file in the category of 2.2 (the author seems to be 2.0, someone may have changed it), Request. form cannot be used. It conflicts with this class. This may be the reason why the blue font is mentioned, but Request. QueryString can be used. To solve the problem of transferring a file and passing the variable value, I use the following methods:

 

If batch upload is set, xml files are uploaded to the server and then written to mdb. If not, variable values are extracted using form.

In batch, change the address submitted by tea_savework.asp? Piliang = true &..... Other variable values are the following code:


If piliang = "" then
%>
<Form name = "form1" method = "post" action = "tea_savework.asp">
<% Else %>
<Form name = "form1" method = "post" action = "tea_savework.asp? Piliang = true & cla_id = <% = set_cla_id %> & sub_id = <% = set_sub_id %> & ter_id = <% = set_ter_id %> & bwc_id = <% = set_bwc_id %>" enctype = "multipart/form-data">
<% End if %>

.....

<% If piliang = "on" then %> select the Excel file for uploading the score (the score file created using the template must be used) <input name = "wenjian" type = "file"> <% end if %>
<Input type = "submit" name = "Submit3" value = "Enter the test scores of the entire class">
<Input name = "bbs_count" type = "hidden" id = "bbs_count" value = "<% = I %>" size = "2">
<Input name = "cla_id" type = "hidden" id = "cla_id" value = "<% = set_cla_id %>" size = "2">
<Input name = "sub_id" type = "hidden" id = "sub_id" value = "<% = set_sub_id %>" size = "2">
<Input name = "ter_id" type = "hidden" id = "ter_id" value = "<% = set_ter_id %>" size = "2">
<Input name = "bwc_id" type = "hidden" id = "bwc_id" value = "<% = set_bwc_id %>" size = "2">

Bytes -------------------------------------------------------------------------------------------------------------------------

Save code in tea_savework.asp:

Test = 0
If request. querystring ("piliang") = "true" then
Cla_id = Request. QueryString ("cla_id ")
Ter_id = Request. QueryString ("ter_id ")
Sub_id = Request. QueryString ("sub_id ")
Bwc_id = Request. QueryString ("bwc_id ")
Call savefile () 'first obtains the variable value and then saves the file. The specific code is not written.
Test = 1
Else
Bbs_count = Request. form ("bbs_count ")
Bbs_count = request. form ("bbs_count ")
Cla_id = request. form ("cla_id ")
Ter_id = request. form ("ter_id ")
Sub_id = request. form ("sub_id ")
Bwc_id = request. form ("bwc_id ")
End if

When this class is used, the request cannot be passed. the form to get parameters conflicts with the operations to read files in this class. It is suspected that the method mentioned in the blue font above is used to destroy the parameters in form. If you first use form to get parameters, then this class cannot read the file ...... So get it using querystring? Then create a class to read and save the uploaded binary file.

TMD hasn't implemented asp for a long time. I haven't mentioned asp files in all the books in my hand. the browser should unify the format of the submitted files, however, asp has a special processing method for this object. It was originally thought that the form could be used to obtain the parameter value and read the uploaded binary file using the class. Now it seems that the two are in conflict, if you use form to obtain parameters, it seems that the submitted data will be damaged. Is it because the form method has processed the binary file format?

The BinaryRead method reads ??? I don't know !!!

Maybe after the form method is used to get the parameter value, can other methods be used to get the uploaded binary file? I think Microsoft's asp should have its own method and should not destroy the uploaded binary files. I just don't know how to use it. At present, there are only a few people who analyze it, even if the analysis is still N years (probably around 04 years) the pre-analysis should not be thorough.


I haven't spoken for a long time, and I don't know what I have said ...... Just show it to yourself as a note. Don't read it anymore ~~~~

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.