About form delivery

Source: Internet
Author: User
For form submission, I want to use a form to submit an image, represented by an img tag. it is not the type selected by the input tag of the file type, can it? Below are some html and php code: HTML: & lt; form & nbsp; action = "demo. php" & nbsp; method = "post" enctype = "m about form submission
I want to submit an image in a form, represented by an img tag. it is not selected using a file-type input tag. Is it OK?
The following are some html and php code:
HTML:

PHP:
$ Imga = $ _ FILES ["id1"];
Echo "Invalid file ";
?>

------ Solution --------------------
No ..
------ Solution --------------------
$ _ FILES only Control exists
------ Solution --------------------
Reference:
$ _ FILES only Control exists


+ 1

Form also needs to set encryption or something.
------ Solution --------------------
Only + Post method
------ Solution --------------------
To upload a file using a form, it must be:
The form must have
Method = "post"
Enctype = "multipart/form-data"
Attribute
Upload using the input type = file control

This is the rule, there is no "why"
------ Solution --------------------
This is what the manual says:

Example 18-1. file upload form


 
In the preceding example, "_ URL _" should be replaced with the actual URL pointing to a PHP file. The MAX_FILE_SIZE hidden field (in bytes) must be prior to the input field of the file, and its value is the maximum size of the received file. In addition, make sure that your file upload form contains enctype = "multipart/form-data". Otherwise, the file upload will not work.

------ Solution --------------------
Html specifications must comply.

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.