There are several fields:
<input type="file" name="file1" /> <input type="file" name="file2" /> <input type="file" name="file3" /> Is it possible to get their name tag in php? And How?
There are several fields:
<input type="file" name="file1" /> <input type="file" name="file2" /> <input type="file" name="file3" /> Is it possible to get their name tag in php? And How?
When you send this form to the server, you will have an array of $_FILES , in which the keys will be these three (or how many of them) fields, and the values will be the data about the downloaded files.
Here is your form:
<form enctype="multipart/form-data" method="post"> <input type="file" name="file1" /> <input type="file" name="file2" /> <input type="file" name="file3" /> <input type="submit"> </form> In file2 I enter the PNG file and send it. In the variable $_FILES I get
array(3) { ["file1"]=> array(5) { ["name"]=> string(0) "" ["type"]=> string(0) "" ["tmp_name"]=> string(0) "" ["error"]=> int(4) ["size"]=> int(0) } ["file2"]=> array(5) { ["name"]=> string(12) "download.png" ["type"]=> string(9) "image/png" ["tmp_name"]=> string(14) "/tmp/phpVvZcNz" ["error"]=> int(0) ["size"]=> int(336) } ["file3"]=> array(5) { ["name"]=> string(0) "" ["type"]=> string(0) "" ["tmp_name"]=> string(0) "" ["error"]=> int(4) ["size"]=> int(0) } } $_POST , $_GET , $_REQUEST . ( php.net/manual/en/reserved.variables.php ) If you send a form to the server in which enctype="multipart/form-data" , then $_FILES variable will be. However, note that this is an ASSOCIATIVE array. Those. you need not $_FILES[0] , but foreach($_FILES as $field=>$fieldData){ - cyadvertvar_dump($_FILES) , look at the contents ... - cyadvertSource: https://ru.stackoverflow.com/questions/489682/
All Articles