Reputation: 912
I am trying to implement JQuery File Upload plugin with Gravity Forms wordpress plugin. I have created a form with file upload input for which Gravity form generated field id like input_1_33. I am using this id for file upload jquery plugin.
jQuery(function () {
var url = 'http://localhost/wp-content/themes/testtheme/fileupload/';
jQuery('#input_1_33').fileupload({
replaceFileInput:false,
url: url,
dataType: 'json',
done: function (e, data) {
jQuery.each(data.result.files, function (index, file) {
jQuery('<p/>').text(file.name).appendTo('#files');
});
},
fail:function(e, data){
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
jQuery('#progress .progress-bar').css(
'width',
progress + '%'
);
}
}).prop('disabled', !jQuery.support.fileInput)
.parent().addClass(jQuery.support.fileInput ? undefined : 'disabled');
});
No error was generated in browser console and file is not uploaded
Upvotes: 0
Views: 1281
Reputation: 138
I've created a plugin that integrates this with Gravity Forms.
You can find it on the WordPress plugin directory - https://wordpress.org/plugins/ajax-upload-for-gravity-forms/
And see a demo of it here - http://demo.itsupportguides.com/ajax-upload-for-gravity-forms/
Upvotes: 1