在页面加载时上传swf请求URL

时间:2012-09-11 11:45:00

标签: javascript asp.net flash uploadify

我在Asp.net网站上使用Uploadify,该页面的网址是/ Resource / Create / id,但是在页面加载uploadify似乎正在向该网页的根网址发送请求/资源/创建/

这导致服务器错误,因为没有提供id并填满我的日志,是否有人知道它可以请求什么,以及是否可以设置为不请求此URL。这是我的JS:

var id = $('#fileUpload').attr('data-id');
$('#fileUpload').uploadify({
  'swf': '/Scripts/Libraries/uploadify/uploadify.swf',
  'uploader': '/Resource/Upload/' + id
})

2 个答案:

答案 0 :(得分:13)

我已按照eugen对此主题的评论解决了这个问题,

http://www.uploadify.com/forum/#/discussion/7329/uploadify-v3-bug-unecessary-request-when-there-is-no-button_image_url-set-/p1

  

在文件的上半部分找到以下代码:

     

this.settings.upload_url =   SWFUpload.completeURL(this.settings.upload_url); this.settings.button_image_url   = SWFUpload.completeURL(this.settings.button_image_url)

     

并将其重写为:

     

this.settings.upload_url =   SWFUpload.completeURL(this.settings.upload_url); this.settings.button_image_url   = this.settings.button_image_url? SWFUpload.completeURL(this.settings.button_image_url):   this.settings.button_image_url

答案 1 :(得分:1)

troyanx,给我一个很好的提示,这有效!只需在jquery.uploadify.js(.min或不是)中替换:

this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); 

有:

if (this.settings.button_image_url != "") { this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);}

在我的情况下,swf的加载请求加载uploadify的页面的同一个url文件夹。

来自:http://www.uploadify.com/forums/discussion/comment/16999#Comment_16999