onComplete and onCompleteAll events failing to fire when using Uploadify

谁说胖子不能爱 提交于 2019-11-29 02:07:37

RESOLVED!

Right, i gather this is about the only article on the entire internet (including the Uploadify documentation and support pages) that describes the quirks of Uploadify in a .Net MVC application

Having done extensive testing, I have seen that:

  1. If the script that accepts the uploaded files (specified in the uploadify initialize code as 'script': '/Album/Manage/') does not return anything, Uploadify's response events dont fire - I gather that an error stops it processing. My script was an action in a controller whose return type was string. If there was an error, it returned the error as a string, otherwise returned nothing. All I did to fix this was make it return 'OK' if nothing went wrong instead of nothing.

  2. Passing script data (specified in the uploadify initialize as 'scriptData': {'album_id':'7'}) the way I was doing it was ALSO causing an error - I havent worked out why (and RonnieSan, the father of Uploadify, didnt seem to see anything wrong with it) so if anyone does know maybe they can respond to this post

  3. You MUST NOT put single quotes around the event handlers e.g. onComplete: function(event, queueID, fileObj, response, data) { ... }

Hope this helps - if anyone needs assistance with .Net MVC implementation, just drop me a message.

I have been using uploadify in an .NET MVC Application as well. And I know exactly what you mean. All I did to fix your problem was make my controller's action return a JSON response and I could parse it back on the onComplete event. The only time I had a problem with events were if the actual file is missing (as I display thumbnails of the image) on the response.

For those who are using Macs use HTTP Scoop to view the request as Firebug does not show it. More on HTTP Scoop from this blog.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!