Httpinputfile inherits from httppostedfile. httpinputfile has multiple postedfiles to access the uploaded file objects. Httppostedfile is the object of the file.
The HTML control is used to upload files,
1. When a form is submitted to this page, you can directly access the object to obtain the submitted file, that is, the httpinputfile object.
2. When the form is submitted to another webpage (this can be seen in another article)
If IFRAME is used for submission, the control object cannot be found in request ["Control name"]. The request must be used. files ["Control name"] to find the object to be uploaded.
For example:
Single Table Page, html
(Note that IFRAME is outside the Form, and form action is the processing page. method generally has better post, and Target attribute is the IFRAME to be processed)
Function chk_imgpath (){
Document. getelementbyid ('form1'). Submit ();
}
<Form name = "form1" id = "form1" method = "Post" Action = "Upload. aspx? Action = upload "enctype =" multipart/form-Data "target =" myiframe ">
<Input type = "file" name = "file1" id = "file1" style = "width: 300px; Border: #999999 1px solid">
<A href = "#" id = "mysubmit" onclick = "Return chk_imgpath ()"> </a>
</Form>
<IFRAME width = "505" Height = "500" name = "myiframe" id = "myiframe" frameborder = "0" scrolling = "no"> </iframe>
Processing page, Background File
System. Web. httppostedfile fileupload2 = request. Files ["file1"];
Supplement: Determine the upload file type upload. postedfile. contenttype. For example, image indicates the image.