0

脚本

<script>
    $(document).ready(function () {
        console.log('@Url.Content(Request.Url.Authority + "/Content/uploadify/uploadify.swf")');
        $(function () {
            $("#file").uploadify({
               'uploader': '@Url.Content(Request.Url.Authority + "/Content/uploadify/uploadify.swf")',
               'script': '@Url.Action("_UploadImage", "Authors", new { area = "Admin" })',
               'cancelImg': '@Url.Content(Request.Url.Authority + "/Content/uploadify/uploadify-cancel.png")',
               'auto': false,
               'multi': false
            });
        })
    });
</script>

html

@using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data", id = "form_image" }))
{
    <p>
        <input type="file" name="file" id="file" />
        <a href="javascript:$('#file').uploadifyUpload();">Resmi Yükle</a>
    </p>
}

consol 日志输出与我预期的一样正确。

localhost:4574/Content/uploadify/uploadify.swf

错误信息:

GET localhost:4574/Admin/uploadify.swf?preventswfcaching=1360522154772 404(未找到)

注意:脚本和 html 代码位于名为“Admin”的区域中。

我找不到我想念的东西。有什么建议吗?

谢谢...

4

1 回答 1

1

BUG当没有背景图片uploadify 对当前页面url 发出错误的http 请求,最后附加false。

这个错误的解决方案在于“jquery.uplodify.js”。只要找到这条线

  • this.settings.upload_url = WFUpload.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
于 2016-09-16T08:17:17.907 回答