Home > Article > Backend Development > 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['file'];//获得文件的相关信息,file是input的name if( $f['size']>1024*600 ){ exit('图片大小超过系统限制(600KB)'); } } ?>
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!