Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does PHP upload files?

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to upload files on PHP". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to upload files with PHP".

First, upload files

1. Create a new html page and upload files

The enctype attribute specifies which content type to use when submitting the form. Use "multipart/form-data" when the form requires binary data, such as the contents of the file.

Jay Chou

Upload files choose to upload files:

Running result:

2. Set the upload path of temporary files in the PHPstudy environment, from the php configuration file

; File Uploads; Whether to allow HTTP file uploads.; http://php.net/file-uploadsfile_uploads = On; Temporary directory for HTTP uploaded files (will use system default if not; specified).; http://php.net/upload-tmp-dirupload_tmp_dir = c:\ test; Maximum allowed size for uploaded files.; http://php.net/upload-max-filesizeupload_max_filesize = 2m Maximum number of files that can be uploaded via a single requestmax_file_uploads = 20

3. Write the sc.php for uploading files

Move_uploaded_file: moving a temporary file to another place is equivalent to saving the file

_ _ DIR__; gets the current directory of the script

At this point, I believe you have a deeper understanding of "how to upload files on PHP". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report