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.