Php file upload to get the file extension. a prompt will be reported during runtime.

Source: Internet
Author: User
Tags php file upload
Php file Upload gets the file extension. during The runtime, a message is displayed indicating that you want to upload files today. However, if you encounter a very tangled problem, you can directly check the code: file upload page: index.html & lt ;! DOCTYPE & nbsp; html & nbsp; PUBLIC & nbsp;-W3CDTD & nbsp; HTML & nbsp; 4.01 & nbsp; TransitionalEN & nbsp; www. php file upload to get the file extension. a prompt will be displayed at runtime.
I practiced file Upload today, but I encountered a very tangled problem.

View the code directly:

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']; // A message is displayed.
// Exit;
$ V ['ext '] = $ info ['extension']; // get the file extension.
$ V ['filename'] = $ info ['filename']; // get the file name
Echo $ v ['ext ']; // get the correct extension
Exit;
}


This is the case. when I echo $ info ['extension'], the message "Notice: Undefined index: extentsion in D: \ WW..." is always reported .......
"Extension" exists in var_dump ($ info ).
However, as shown in the code above, $ v ['text'] = $ info ['extension']; then, I echo $ v ['text']; to get the correct suffix
What is the situation ??

------ Solution --------------------
// Echo $ info ['extentsion']; // A message is displayed.
Echo $ info ['extension']; // A message is displayed.
Note Spelling. how can a teenager make 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.