0

我在我的 MVC3 程序中使用 SWFUpload。它在 IE 和 Chrome 中运行良好。但我的文件无法在 FireFox 中上传。它甚至没有进入上传操作。在我的程序中,用户应该先登录。当我在用户不必登录的测试程序中使用 SWFUpload 时,它也能正常工作。谁能告诉我如何解决这个问题?这是我的代码:

Js:
   swfupload1 = new SWFUpload({
        upload_url: '@Url.Action("Upload")',
        post_params: { "name": "value" },

        file_size_limit: "200000000",
        file_types: "*.jpg;*.gif;*.png;*.jpeg",
        file_types_description: "",
        file_upload_limit: "1",
        file_queue_limit: "1",

        file_queue_error_handler: fileQueueError,
        file_dialog_complete_handler: fileDialogComplete,
        file_queued_handler: fileQueued,
        upload_progress_handler: uploadProgress,
        upload_error_handler: uploadError,
        upload_success_handler: uploadSuccess, 
        upload_complete_handler: uploadComplete,
        upload_start_handler: uploadStart,

        button_image_url:'@Url.Content("~/Swfupload/images/XPButtonNoText2_160x22.png")', 
        button_placeholder_id: "spanButtonPlaceholder1", 
        button_width: 42,
        button_height: 22,
        button_text: '<span class="buttonCss">选择</span>', 
        button_text_style: ".buttonCss { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }", 
        button_text_top_padding: 1,
        button_text_left_padding: 5,
        button_cursor: SWFUpload.CURSOR.HAND,
        button_action: SWFUpload.BUTTON_ACTION.SELECT_FILE, 

        flash_url: '@Url.Content("~/Swfupload/swfupload.swf")',
        custom_settings: { upload_target: "divFileProgressContainer1" },

        debug: false
    });

控制器:

    [HttpPost]
    public ActionResult Upload(HttpPostedFileBase filedata)
    {
        if (null != filedata)
        {
           filedata.SaveAs(Server.MapPath("/File/Coverurl"+fileData.FileName));
        }
        return Json("");
    }
4

1 回答 1

0

我建议有兴趣的人在这里看看解决方案:http ://www.cnblogs.com/rupeng/archive/2012/01/30/2332427.html 。

于 2013-02-26T05:51:34.850 回答