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
4 Answers
Reset to default 4To 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
版权声明:本文标题:javascript - Uploadify v3.1 passing POST Data - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745006730a2637307.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论