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?