PHP File upload get file extension, runtime will notify

Source: Internet
Author: User
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?
  • 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.