Asp.Net Mvc 上传? [英] Asp.Net Mvc uploadify?

查看:36
本文介绍了Asp.Net Mvc 上传?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

脚本

<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 日志输出与我预期的一样正确.

consol log output that is the correct as my expected.

localhost:4574/Content/uploadify/uploadify.swf

localhost:4574/Content/uploadify/uploadify.swf

错误信息:

获取本地主机:4574/Admin/uploadify.swf?preventswfcaching=1360522154772404(未找到)

GET localhost:4574/Admin/uploadify.swf?preventswfcaching=1360522154772 404 (Not Found)

注意:script 和 html 代码位于名为Admin"的区域.

Note: script and html codes are in an area that is named "Admin".

我找不到我遗漏了什么.有什么建议吗?

I cant find what am I missing. Any advice?

谢谢...

推荐答案

BUG 当没有背景图片时uploadify对当前页面url进行了错误的http请求,最后追加false.

BUG When there is no background image uploadify makes a wrong http request to the current page url, appending false at the end.

此错误的解决方案在于jquery.uplodify.js".只要找到这一行

The solution for this bug lies in "jquery.uplodify.js". Just find this line

  • 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

这篇关于Asp.Net Mvc 上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆