PHP file upload to get the file extension, the runtime will report prompt
Today practice file upload operation, but encountered a very tangled matter
Look directly at the code:
File Upload page: index.html
Insert Title here
File Processing page: test.php
foreach ($_files as $v) {
$info =pathinfo ($v [' name ']);
Var_dump ($info);//View the information in $info;
Exit
echo $info [' extentsion '];//news tip
Exit
$v [' ext ']= $info [' extension '];//get the file name extension
$v [' filename ']= $info [' filename '];//get file name
echo $v [' ext '];//to get the correct extension
Exit
}
The thing is this, when I echo $info [' extension '] always tip: notice:undefined index:extentsion in D:\WW ....
When I var_dump ($info), there really is "extension" in it.
However, as shown in the code above $v[' ext ']= $info [' extension '); I echo $v [' ext ']; but I can get the correct suffix.
What the hell's the situation?
------Solution--------------------
echo $info ['
extentsion'];//Newspaper Tips
echo $info ['
extension'];//Newspaper Tips
Pay attention to spelling, how can a teenager have a mistake?