开发者

Uploadify and flash issue uploading to remote server

I'm trying to use uploadify to upload images to a remote server. I've have done everything I can think of for the cross scripting issue or whatever.

Here is what i've done.

scriptAccess to 'Always' in the uploadify function. I have a crossdomain.xml on my ww2 server with uploadify.swf in the root as well. I have uploaded my javascript jquery lib file to the remote ww2 server and put it in the header I put the jquery.uploadify.js and the swfobject.js in the root directory as well.

If I try to click the X to cancel a file I get the error: Error calling method on NPObject Or uploads don't work either.

If anyone can help with this that would be great. If there are any other good flash based or non 开发者_开发技巧flash based multi uploaders that will do remote files with no issue please let me know.

Thanks


I managed to figure it out on my own. I will answer it just incase someone else might have this issue because there is very little help even on the authors site for it.

I decided to leave the Flash file on the same server(Web server) because it didnt seem to work putting it on the media server with the javscript files. The js wouldn't work. So my main server has the uploadify folder still on the server and I only put the php files(uploader.php) I needed to process my images on the media server AND the crossdomain.xml in the root of that server. Then told uploadify in the parameter settings to point to my uploader.php script on that server. Everything worked like a charm after that. I took quite a while to figure it out and get passed the errors. Now I can load balance my media. Hope this helps someone else. Uploadify is a really nice multi file uploader.


You need to change code in your uploadify.js:

/* Original code */
 uploadifyCancel:function(ID) {

                            jQuery(this).each(function() {



                               document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, true, false);

                            });

                       },




   /*New code */

    uploadifyCancel:function(ID){

                    jQuery(this).each(function(){

                        document.getElementById(jQuery(this).attr("id")+"Uploader").cancelFileUpload(ID,true,false)

                    });

                },



/*Original code */


                               jQuery(this).bind("uploadifyComplete", {

                                  'action': settings.onComplete

                                  }, function(event, ID, fileObj, response, data) {

                                  if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) {

                                       jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(' - Completed');

                                       if (settings.removeCompleted) {

                                           jQuery("#" + jQuery(event.target).attr('id') + ID).fadeOut(250,function() {

                                               jQuery(this).remove()

                                               });

                                     }

                                     jQuery("#" + jQuery(event.target).attr('id') + ID).addClass('completed');

                                   }

                               });


/* New code */

 jQuery(this).bind("uploadifyProgress", {

                        'action': settings.onProgress,

                        'toDisplay': settings.displayData

                    }, function(event, ID, fileObj, data) {

                        if (event.data.action(event, ID, fileObj, data) !== false) {

                            jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").animate({

                                'width': data.percentage + '%'

                            },250,function() {

                                if (data.percentage == 100) {

                                    jQuery(this).closest('.uploadifyProgress').fadeOut(250,function() {

                                        jQuery(this).remove()

                                    });

                                }

                            });

                            if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%';

                            if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s';

                            if (event.data.toDisplay == null) displayData = ' ';

                            jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(displayData);

                        }

                    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜