PHP file upload to get the file extension, the runtime will report prompt

Source: Internet
Author: User
Tags php file upload
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 information in $info;//exit;//echo $info [' Extentsion '];//newspaper hint//exit; $v [' ext ']= $info [' extension '];//get file extension $v[' filename ']= $info [' filename '];//get file name echo $v [ ' ext '];//can get the right 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?


Reply to discussion (solution)

echo $info [' extentsion '];//news tip
echo $info [' extension '];//news tip
Pay attention to spelling, how can a teenager have a mistake?

The editor does not give the force, the oneself dizzy.

echo $info [' extentsion '];//news tip
echo $info [' extension '];//news tip
Pay attention to spelling, how can a teenager have a mistake?




Last time also because of a letter,,,, how I always so careless
  • 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.