forked from ntulip/swfupload-jquery-plugin
/
01 - single uploader.html
73 lines (68 loc) · 2.51 KB
/
01 - single uploader.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SWFUpload Example - Single Uploader</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="../vendor/swfupload/swfupload.js"></script>
<script type="text/javascript" src="../src/jquery.swfupload.js"></script>
<script type="text/javascript">
$(function(){
$('#swfupload-control').swfupload({
upload_url: "upload.php",
file_size_limit : "10240",
file_types : "*.*",
file_types_description : "All Files",
file_upload_limit : "0",
flash_url : "../vendor/swfupload/swfupload.swf",
button_image_url : '../vendor/swfupload/XPButtonUploadText_61x22.png',
button_width : 61,
button_height : 22,
button_placeholder : $('#button')[0],
debug: true,
custom_settings : {something : "here"}
})
.bind('swfuploadLoaded', function(event){
$('#log').append('<li>Loaded</li>');
})
.bind('fileQueued', function(event, file){
$('#log').append('<li>File queued - '+file.name+'</li>');
// start the upload since it's queued
$(this).swfupload('startUpload');
})
.bind('fileQueueError', function(event, file, errorCode, message){
$('#log').append('<li>File queue error - '+message+'</li>');
})
.bind('fileDialogStart', function(event){
$('#log').append('<li>File dialog start</li>');
})
.bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
$('#log').append('<li>File dialog complete</li>');
})
.bind('uploadStart', function(event, file){
$('#log').append('<li>Upload start - '+file.name+'</li>');
})
.bind('uploadProgress', function(event, file, bytesLoaded){
$('#log').append('<li>Upload progress - '+bytesLoaded+'</li>');
})
.bind('uploadSuccess', function(event, file, serverData){
$('#log').append('<li>Upload success - '+file.name+'</li>');
})
.bind('uploadComplete', function(event, file){
$('#log').append('<li>Upload complete - '+file.name+'</li>');
// upload has completed, lets try the next one in the queue
$(this).swfupload('startUpload');
})
.bind('uploadError', function(file, errorCode, message){
$('#log').append('<li>Upload error - '+message+'</li>');
});
});
</script>
</head>
<body>
<div id="swfupload-control">
<ol id="log"></ol>
<input type="button" id="button" />
</div>
</body>
</html>