uploadify and each file description

Posted by kusanagi on Stack Overflow See other posts from Stack Overflow or by kusanagi
Published on 2010-05-23T21:58:24Z Indexed on 2010/05/23 22:01 UTC
Read the original article Hit count: 637

Filed under:
|
|

i want to upload many files and set to each file a description. i have such code

     <div>
        <textarea cols="60" id="descriptions" name="descriptions" rows="10">
</textarea>
    </div>       
        <div id="fileQueue">
        </div>
        <div>
            <input type="file" name="attach" id="attach" />
        </div>
        <p>
            <input type="button" id="submit" value="????????" class="bluebutton" /><br />
            <a href="javascript:jQuery('#attach').uploadifyClearQueue()">???????? ????????</a>
        </p>

        <script type="text/javascript">

            var description = "";
            var mas;
            var i = 0;

            $(document).ready(function() {
                $("#attach").uploadify({
                    'uploader': '/uploadify/uploadify.swf',
                    'script': '/uploadify/upload.ashx',
                    'cancelImg': '/uploadify/cancel.png',
                    'queueID': 'fileQueue',
                    'multi': true,
                    'onOpen': function(event, queueID, fileObj) {

                        if (i < mas.length) {
                            description = mas[i++];

                        }
                    },
                    'onComplete': function(event, data) {
                        description = "";

                    }
                });



                $("#submit").click(function() {
                    i = 0;
                    mas = $("#descriptions").val().split('\n');
                    $('#attach').uploadifySettings("scriptData", { 'description': description });
                    $('#attach').uploadifyUpload();
                });
            });
        </script>

so idea- i put short description into textarea descriptions, then i make array and try to put one item of array to apload script, but it not work. description is null. any ideas?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery