The ability to upload photos is a main feature of bp-gallery. Can someone explain to me why Flash is a necessary element to bulk upload photos? I've turned off the Flash uploader and uploading a single file works, minus the ability to upload multiple photos with ajax.
I can see that j("#bulk_upload_media_submit").live('click',function() {
in theme.js is only setup to handle flash...
There are no ajax calls in this function.
I tried copying the function from j("#gallery_save_from_web").live("click",function(){
to duplicate what it does, (i've changed the actions and the necessary ids), but then i get errors from bp_gallery_ajax_save_gallery_media, which is reporting that the file i'm uploading has no size. This can't be the case because I can upload the photo without ajax and without flash enabled.
Why can I bulk embed videos without flash from add from web, but not be able to bulk upload photos without flash? I've dug into the code and I see that functions have been half-written for this feature.
Has anyone successfully modified the code or figured out a way to get bulk upload of photos with ajax working?
Below is what I got so far, but like I said it's producing errors from bp_gallery_ajax_save_gallery_media: {"error":{"msg":"This file type is not allowed in current gallery. You must upload a file which is jpg, jpeg, png, gif"}}
I know in this case gallery_web_url is doing nothing but I haven't removed it yet. Any help would be appreciated!!
/**
* @desc Bulk Media Upload Handling
*/
j("#bulk_upload_media_submit").live('click',function() {
if(helper.is_flash_enabled()){
populate_post_params_for_media();//populate the post parameters
guploader.swfupload('startUpload');
return false;
}
j(".guploading").show();//show loading icon
var web_link=j("#gallery_web_url").val();
var gid=j("#galleries-list").val();
var media_status=j("#gallery_status").val();
var nonce=j("#_wpnonce-save-gallery-image").val();
j("#bulk_upload_media_submit").attr('enabled','enabled');
j.post( ajaxurl, {
action: 'save_gallery_media_bulk',
'url':web_link,
'cookie': encodeURIComponent(document.cookie),
'gallery_id':gid,
'media_status':media_status,
'_wpnonce': nonce
},
function(response){
//alert("result");
alert(response);
return false;
//show response
j("#update_media_upload").prepend(response);
j(".guploading").hide();//hide loading icon
j("#bulk_upload_media_submit").attr("enabled",'');
j("#gallery_web_url").val('');
});
return false;
});