Home >Backend Development >PHP Tutorial >PHP+FLASH implements upload file progress bar related files download_PHP tutorial

PHP+FLASH implements upload file progress bar related files download_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:54:28809browse

The reason why it is difficult to implement an upload progress bar in PHP is because when we upload files to the server, we have to wait until all files are sent to the server before executing the corresponding PHP file. Before this, the file data was saved in a temporary file, and PHP could not obtain the path and size of this file.
Starting from Actionscript 2.0, Flash supports file upload and download. Although we cannot get the file upload progress on the server side, we can get the file sending progress on the server side. Based on this principle, you can use Flash to create an upload progress bar effect.
I have seen some information on the Internet, but I feel it is flawed. So I did some research myself, strengthened the security and robustness of the program on the basis of predecessors, and added some customizable parameters.

Note: If your computer has firewall software installed, you may see a progress bar that reaches 100% at once. This is because the progress bar shows the speed of flash transferring files to the firewall software! The firewall also passes the data to the server.
Please click here for demonstration


This program is improved by Longbill based on relevant information on the Internet
http://www.longbill.cn
Email: longbill.cn@gmail .com

Instructions for calling parameters (assuming the name of this flash is upload.swf):

Write the calling address of the flash file as:
upload.swf?maxsize=[Maximum size of a single file ]&bgcolor=[Progress bar color]
&limit=[Limit upload file type]&savefile=[Upload object file]

[Maximum size of a single file]: [Optional] [Number] (unit is KB )
[Progress bar color]: [Optional] [Six-digit hexadecimal number] [Default is random color] (16-bit color value without #)
[Restrict upload file type]: [Yes Select] format such as: limit=zip|rar|doc
[Upload object file]: [Default is save.php] [String]

For example:
upload.swf?maxsize=2048&bgcolor =FF00FF&limit=jpg|gif|png&savefile=upsave.php

Package file download

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318477.htmlTechArticleThe reason why it is difficult to implement an upload progress bar in PHP is because when we upload a file to the server, we have to wait until the file is complete After sending it to the server, the corresponding php file is executed. Before that,...
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