Home  >  Article  >  Backend Development  >  How to get the file name when uploading a file in php

How to get the file name when uploading a file in php

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-09-28 16:15:407120browse

How to get the file name when uploading a file in php

How to get the file name of a file uploaded in php? The specific method is as follows:

Related recommendations: "php Getting Started Tutorial"

After uploading this image using file type input, upload the image to your server The temporary directory, and the file-related information is stored in the _FILE parameter.

<?php
if($dosubmit){
$f = $_FILES[&#39;file&#39;];//获得文件的相关信息,file是input的name
if( $f[&#39;size&#39;]>1024*600 ){
exit(&#39;图片大小超过系统限制(600KB)&#39;);
}
}
?>

Using the get form to submit ordinary parameters can be obtained through $_GET, and the same post submission can be obtained through $_POST. Of course, you have to get the information about the files inside through $_FILES!

The above is the detailed content of How to get the file name when uploading a file in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn