swfupload multiple file upload sample code

怪我咯
Release: 2023-03-13 16:08:01
Original
1222 people have browsed it

SWFUpload is a combination of flash and jsFile uploadPlug-in

Features of SWFUpload

1. Use flash to upload, the page does not refresh, and The style of the Flash button can be customized;

2. You can limit the files to be uploaded on the browser side;

3. Allow multiple files to be uploaded at one time, but there will be one upload Queue, the files in the queue are uploaded one by one. When the server receives the file, it is the same as the ordinary form upload file;

4. Provides a wealth of eventsInterface for developers to use;

SWFUpload file upload process:

1.Introduce the corresponding js file

2.Instantiate SWFUploadobject, pass in a configuration parameter object to configure various aspects.

3. Click the Flash button provided by SWFUpload, and the file selection window will pop up to select the file to be uploaded;

4. After the file selection is completed, the files that meet the requirements will be added to the upload queue;

5. Call the startUpload method to start uploading files in the queue;

6. Corresponding events will be triggered during the file upload process. Developers use these events to update the UI, handle errors, and issue prompts. Wait;

The following code uses flash+ajax methodto upload files, the code is as follows

var swfu; 
window.onload = function() { 
var settings = { 
flash_url : "js/swfupload_f9.swf", //flash地址 
upload_url: "upload.php", //上传文件处理地址 
post_params: {"PHPSESSID" : "“}, 
file_size_limit : “1000″, //大小限制 默认单位为kb 
file_types : “*.jpg;*.gif;*.png;*.swf”,//文件类型 
file_types_description : “Web Image Files”,//文件类型描述 
file_upload_limit : 100,//上传文件限制 
file_queue_limit : 0, 
custom_settings : { 
progressTarget : “fsUploadProgress”, 
cancelButtonId : “btnCancel” 
}, 
debug: false, 

file_queued_handler : fileQueued, 
file_queue_error_handler : fileQueueError, 
file_dialog_complete_handler : fileDialogComplete, 
upload_start_handler : uploadStart, 
upload_progress_handler : uploadProgress, 
upload_error_handler : uploadError, 
upload_success_handler : uploadSuccess, 
upload_complete_handler : uploadComplete, 
queue_complete_handler : queueComplete 
}; 

swfu = new SWFUpload(settings); 
};
Copy after login

The above is the detailed content of swfupload multiple file upload sample code. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!