Project

General

Profile

Statistics
| Branch: | Revision:

colonymech / docs / www / colonyscout / internal / uploadify / uploadify-jgrowl.php @ f59acf11

History | View | Annotate | Download (2.77 KB)

1
<html xmlns="http://www.w3.org/1999/xhtml">
2
<head>
3
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
4
<title>Uploadify with jGrowl Sample</title>
5

    
6
<link rel="stylesheet" href="uploadify/uploadify.css" type="text/css" />
7
<link rel="stylesheet" href="css/uploadify.jGrowl.css" type="text/css" />
8

    
9
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
10
<script type="text/javascript" src="js/jquery.uploadify.js"></script>
11
<script type="text/javascript" src="js/jquery.jgrowl_minimized.js"></script>
12

    
13
<script type="text/javascript">
14

15
$(document).ready(function() {
16
        $("#fileUploadgrowl").fileUpload({
17
                'uploader': 'uploadify/uploader.swf',
18
                'cancelImg': 'uploadify/cancel.png',
19
                'script': 'uploadify/upload.php',
20
                'folder': 'files',
21
                'fileDesc': 'Image Files',
22
                'fileExt': '*.jpg;*.jpeg;*.png;*.gif',
23
                'multi': true,
24
                'simUploadLimit': 3,
25
                'sizeLimit': 1048576,
26
                onError: function (event, queueID ,fileObj, errorObj) {
27
                        var msg;
28
                        if (errorObj.status == 404) {
29
                                alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
30
                                msg = 'Could not find upload script.';
31
                        } else if (errorObj.type === "HTTP")
32
                                msg = errorObj.type+": "+errorObj.status;
33
                        else if (errorObj.type ==="File Size")
34
                                msg = fileObj.name+'<br>'+errorObj.type+' Limit: '+Math.round(errorObj.sizeLimit/1024)+'KB';
35
                        else
36
                                msg = errorObj.type+": "+errorObj.text;
37
                        $.jGrowl('<p></p>'+msg, {
38
                                theme:         'error',
39
                                header: 'ERROR',
40
                                sticky: true
41
                        });                        
42
                        $("#fileUploadgrowl" + queueID).fadeOut(250, function() { $("#fileUploadgrowl" + queueID).remove()});
43
                        return false;
44
                },
45
                onCancel: function (a, b, c, d) {
46
                        var msg = "Cancelled uploading: "+c.name;
47
                        $.jGrowl('<p></p>'+msg, {
48
                                theme:         'warning',
49
                                header: 'Cancelled Upload',
50
                                life:        4000,
51
                                sticky: false
52
                        });
53
                },
54
                onClearQueue: function (a, b) {
55
                        var msg = "Cleared "+b.fileCount+" files from queue";
56
                        $.jGrowl('<p></p>'+msg, {
57
                                theme:         'warning',
58
                                header: 'Cleared Queue',
59
                                life:        4000,
60
                                sticky: false
61
                        });
62
                },
63
                onComplete: function (a, b ,c, d, e) {
64
                        var size = Math.round(c.size/1024);
65
                        $.jGrowl('<p></p>'+c.name+' - '+size+'KB', {
66
                                theme:         'success',
67
                                header: 'Upload Complete',
68
                                life:        4000,
69
                                sticky: false
70
                        });
71
                }
72
        });
73
});
74

    
75
</script>
76
</head>
77

    
78
<body>
79
    <fieldset style="border: 1px solid #CDCDCD; padding: 8px; padding-bottom:0px; margin: 8px 0">
80
                <legend><strong>Upload Files - Growl Sample</strong></legend>
81
                <p>File Size Limited to 1Mb. Also try cancelling an upload.</p>
82
                <div id="fileUploadgrowl">You have a problem with your javascript</div>
83
                <a href="javascript:$('#fileUploadgrowl').fileUploadStart()">Start Upload</a> |  <a href="javascript:$('#fileUploadgrowl').fileUploadClearQueue()">Clear Queue</a>
84
            <p></p>
85
    </fieldset>
86
</body>
87
</html>