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

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

爱喝马黛茶的安东尼
Release: 2023-02-25 13:22:01
Original
7149 people have browsed it

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;);
}
}
?>
Copy after login

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!

Related labels:
source:php上传文件怎么获取文件名
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template