admin管理员组

文章数量:1406312

Iam getting Crazy with JQuery Uploadify V3.1.

// setup fileuploader
$("#file_upload").uploadify({
    'swf': 'flash/uploadify.swf',
    'uploader' : 'upload/do-upload',
    'debug' : false,
    'buttonText': 'Files auswählen',
    'multi': true,
    'method': 'POST',
    'auto': false,
    'width': 250,
    'queueSizeLimit' : 10,
    'fileSizeLimit' : '100MB',
    'cancelImg': 'img/uploadify-cancel.png',
    'removeCompleted' : true,
    'onUploadSuccess' : function(file, data, response) {
        $('#message').append(data);
    },
    'onUploadError' : function() {
        $('#message').html('<h2>Fehler beim Upload</h2>');
    }
});

To start Download onClick

// handle the event stuff
$("#event_start_upload").on({
    click: function(){
        var key = $('#key').val();

        if (key.length < KeyLength) {
            $('#form-encryption-control').addClass('error');
            return;
        } else {
            $('#form-encryption-control').removeClass('error');
        }
        // some space for new download links
        $('#message').empty();
        $('#file_upload').uploadify('upload','*')
    }
});

My Problem is: I have to pass addtional params to the serverSide, in Uploadify V2 there was an Method uploadifySettings to pass "scriptData" , but not in V3? Someone knows how this works?

If someone else needs the clue:

'onUploadStart' : function(file) {
            var key = $('#key').val();
            $("#file_upload").uploadify('settings', 'formData', {'key' : key});
        },

Iam getting Crazy with JQuery Uploadify V3.1.

// setup fileuploader
$("#file_upload").uploadify({
    'swf': 'flash/uploadify.swf',
    'uploader' : 'upload/do-upload',
    'debug' : false,
    'buttonText': 'Files auswählen',
    'multi': true,
    'method': 'POST',
    'auto': false,
    'width': 250,
    'queueSizeLimit' : 10,
    'fileSizeLimit' : '100MB',
    'cancelImg': 'img/uploadify-cancel.png',
    'removeCompleted' : true,
    'onUploadSuccess' : function(file, data, response) {
        $('#message').append(data);
    },
    'onUploadError' : function() {
        $('#message').html('<h2>Fehler beim Upload</h2>');
    }
});

To start Download onClick

// handle the event stuff
$("#event_start_upload").on({
    click: function(){
        var key = $('#key').val();

        if (key.length < KeyLength) {
            $('#form-encryption-control').addClass('error');
            return;
        } else {
            $('#form-encryption-control').removeClass('error');
        }
        // some space for new download links
        $('#message').empty();
        $('#file_upload').uploadify('upload','*')
    }
});

My Problem is: I have to pass addtional params to the serverSide, in Uploadify V2 there was an Method uploadifySettings to pass "scriptData" , but not in V3? Someone knows how this works?

If someone else needs the clue:

'onUploadStart' : function(file) {
            var key = $('#key').val();
            $("#file_upload").uploadify('settings', 'formData', {'key' : key});
        },
Share Improve this question edited Jul 1, 2012 at 16:11 opHasNoName asked Jul 1, 2012 at 7:46 opHasNoNameopHasNoName 20.7k26 gold badges101 silver badges149 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 4

To send a data via uploadify you can use formData For e.g:

$(function() {
$("#file_upload").uploadify({
    'formData'      : {'someKey' : 'someValue', 'someOtherKey' : 1},
    'swf'           : '/uploadify/uploadify.swf',
    'uploader'      : '/uploadify/uploadify.php',
    'onUploadStart' : function(file) {
        $("#file_upload").uploadify("settings", "someOtherKey", 2);
    }
});
});
$("#image_upload1").uploadify(uploadifyBasicSettingsObj);

uploadifyBasicSettingsObj.onUploadSuccess = function(file, data, response) 
{
    $('.tempImageContainer2').find('.uploadify-overlay').show();

    /* Here you actually show your uploaded image.In my case im showing in Div  */
    $('.tempImageContainer2').attr('style','background- image:url("../resources/temp/thumbnail/'+data+'")');
    $('#hidden_img_value2').attr('value',data);
}

This is my code I used in my project in which im actually uploding image to a temp folder and dynamically im showing that image to my DIV(Having class 'tempImageContainer2' ) tag onUploadSuccess

This should help you get going http://www.uploadify./documentation/uploadify/formdata/

Just add 'formData' in your code like this :

 $("#file_upload").uploadify({
        'swf': 'flash/uploadify.swf',
        'uploader' : 'upload/do-upload',
        'debug' : false,
        'buttonText': 'Files auswählen',
        'multi': true,
        'method': 'POST',
        'auto': false,
        'width': 250,
        'queueSizeLimit' : 10,
        'fileSizeLimit' : '100MB',
        'cancelImg': 'img/uploadify-cancel.png',
        'removeCompleted' : true,


        'formData' : {'K':'V','K':'V','K':'V'},


        'onUploadSuccess' : function(file, data, response) {
            $('#message').append(data);
        },
        'onUploadError' : function() {
            $('#message').html('<h2>Fehler beim Upload</h2>');
        }
    });

本文标签: javascriptUploadify v31 passing POST DataStack Overflow