Simple file upload to local file for PHP development (1)

In this section, we use PHP code to upload files to a local folder and display them on the current page.

According to the idea mentioned in the previous section, we first create a simple form for uploading files

   图片上传  
上传文件:
允许上传的文件类型为:

图片预览:

Note here:

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

An image preview is created at the bottom of the page to display the uploaded file.

The PHP code can later display the file name, size, length and width of the file saved in the local folder.


Secondly, we need to make some restrictions on uploaded files:

Types of uploaded files: $uptypes

Alright Set the upload file size, upload file path, etc. Here we have added image watermark settings.


Continuing Learning
||
图片上传
上传文件:



允许上传的文件类型为:
图片预览:
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!