PHP + FLASH implements file download related to the upload progress bar. PHP is difficult to implement the upload progress bar because when we upload files to the server, we need to wait until all the files are sent to the server before executing the corresponding PHP file. Before that, PHP was difficult to implement the upload progress bar because when we uploaded files to the server, we had to wait until all the files were sent to the server before executing the corresponding PHP file. Before that, the file data is stored in a temporary file, and php cannot obtain the path and size of the file.
Flash supports uploading and downloading files starting with Actionscript 2.0. Although the file upload progress cannot be obtained on the server side, we can get the file sending progress on the server side. Based on this principle, you can use Flash to make the upload progress bar effect.
I have seen some materials on the Internet, but I feel defective. So I studied it myself and strengthened the security and robustness of the program based on the predecessors, and added some customizable parameters.
Note: If firewall software is installed on your computer, you may see a progress bar of 100%. This is because the progress bar shows the speed at which flash uploads files to the firewall software! The firewall also transmits data to the server.
Click here for demonstration
This program was developed by Longbill based on relevant online materials.
Call parameter description (assuming the flash name is upload.swf ):
Write the call address of the flash file as follows:
Upload.swf? Maxsize = [maximum volume of a single file] & bgcolor = [progress bar color]
& Limit = [restrict upload file types] & savefile = [Upload object files]
[Maximum size of a single file]: [optional] [number] (unit: KB)
[Progress bar color]: [optional] [six-digit hexadecimal number] [random color by default] (no #16-digit color value)
[Restrict the Upload file type]: [optional] format: limit = zip | rar | doc
[Upload object files]: [save. php by default] [string]
Upload.swf? Maxsize = 2048 & bgcolor = FF00FF & limit = jpg | gif | png & savefile = upsave. php
Package File Download
Bytes. Before that ,...