Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 使用uploadify上载图像时出现HTTP错误405_Asp.net Mvc 3_Html_Uploadify - Fatal编程技术网

Asp.net mvc 3 使用uploadify上载图像时出现HTTP错误405

Asp.net mvc 3 使用uploadify上载图像时出现HTTP错误405,asp.net-mvc-3,html,uploadify,Asp.net Mvc 3,Html,Uploadify,我正在尝试在MVC3中创建一个上载控件 起初,我尝试使用javascript和HTML5创建上载控件,但这在任何IE版本中都不起作用。所以,我已经转到了这个flash版本的uploadify 我上传时收到HTTP错误:405 这是我的javascript代码,用于uploadify $(function () { $('#file_upload').uploadify({ debug:true, 'swf': '/Content/u

我正在尝试在MVC3中创建一个上载控件

起初,我尝试使用javascript和HTML5创建上载控件,但这在任何IE版本中都不起作用。所以,我已经转到了这个flash版本的
uploadify

我上传时收到HTTP错误:405

这是我的javascript代码,用于
uploadify

$(function () {
        $('#file_upload').uploadify({
            debug:true,
            'swf': '/Content/uploadify/uploadify.swf',
            'uploader': '/Content/uploadify/uploadify.php',
            'cancelImg': '/Images/uploadify-cancel.png',
            'script': '/Home/Uploadify',
            'folder': '/Content/uploads',
            auto: true

        });
    });
我甚至尝试过使用
debug:true
来查看出了什么问题,但我无法找到出了什么问题

以下是我的调试输出:

---SWFUpload Instance Info---
Version: 2.2.0 2009-03-25
Movie Name: SWFUpload_0
Settings:
    upload_url:               /Content/uploadify/uploadify.php
    flash_url:                /Content/uploadify/uploadify.swf?preventswfcaching=1355289873808
    use_query_string:         false
    requeue_on_error:         false
    http_success:             
    assume_success_timeout:   30
    file_post_name:           Filedata
    post_params:              [object Object]
    file_types:               *.*
    file_types_description:   All Files
    file_size_limit:          0
    file_upload_limit:        0
    file_queue_limit:         999
    debug:                    true
    prevent_swf_caching:      true
    button_placeholder_id:    file_upload
    button_placeholder:       Not Set
    button_image_url:         /
    button_width:             120
    button_height:            30
    button_text:              
    button_text_style:        color: #000000; font-size: 16pt;
    button_text_top_padding:  0
    button_text_left_padding: 0
    button_action:            -110
    button_disabled:          false
    custom_settings:          [object Object]
Event Handlers:
    swfupload_loaded_handler assigned:  false
    file_dialog_start_handler assigned: true
    file_queued_handler assigned:       true
    file_queue_error_handler assigned:  true
    upload_start_handler assigned:      true
    upload_progress_handler assigned:   true
    upload_error_handler assigned:      true
    upload_success_handler assigned:    true
    upload_complete_handler assigned:   true
    debug_handler assigned:             true

SWF DEBUG: SWFUpload Init Complete
SWF DEBUG: 
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number:           SWFUPLOAD 2.2.0
SWF DEBUG: movieName:              SWFUpload_0
SWF DEBUG: Upload URL:             /Content/uploadify/uploadify.php
SWF DEBUG: File Types String:      *.*
SWF DEBUG: Parsed File Types:      
SWF DEBUG: HTTP Success:           0
SWF DEBUG: File Types Description: All Files (*.*)
SWF DEBUG: File Size Limit:        0 bytes
SWF DEBUG: File Upload Limit:      0
SWF DEBUG: File Queue Limit:       999
SWF DEBUG: Post Params:
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG: 
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.*
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload.  Starting upload to /Content/uploadify/uploadify.php for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 846359. Total: 846359
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 405.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
谁能告诉我,我错在哪里

编辑:

这是从Fiddler跟踪的请求响应:

POST /Content/uploadify/uploadify.php HTTP/1.1
Host: localhost:6930
Connection: keep-alive
Content-Length: 561702
Origin: http://localhost:6930
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11
Content-Type: multipart/form-data; boundary=----------Ef1Ij5Ef1cH2GI3GI3ei4Ij5ae0gL6
Accept: */*
Referer: http://localhost:6930/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

HTTP/1.1 405 Method Not Allowed
Cache-Control: private
Allow: GET, HEAD, OPTIONS, TRACE
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.0
X-SourceFiles: =?UTF-8?B?YzpcdXNlcnNcYWRtaW5pc3RyYXRvclxkb2N1bWVudHNcdmlzdWFsIHN0dWRpbyAyMDEyXFByb2plY3RzXERhdGVBbmRUaW1lQ29udHJvbFxEYXRlQW5kVGltZUNvbnRyb2xcQ29udGVudFx1cGxvYWRpZnlcdXBsb2FkaWZ5LnBocA==?=
X-Powered-By: ASP.NET
Date: Wed, 12 Dec 2012 10:03:44 GMT
Content-Length: 5506

我终于解决了我的问题。困扰我的是
上传程序

上传程序应该是mvc中控制器的操作

以下是解决方案:

$(function () {
        $('#file_upload').uploadify({
            debug:true,
            'swf': '/Content/uploadify/uploadify.swf',
            'uploader': '/Home/Uploadify',
            auto: true

        });
    });

我终于解决了我的问题。困扰我的是
上传程序

上传程序应该是mvc中控制器的操作

以下是解决方案:

$(function () {
        $('#file_upload').uploadify({
            debug:true,
            'swf': '/Content/uploadify/uploadify.swf',
            'uploader': '/Home/Uploadify',
            auto: true

        });
    });

405方法不允许iirc,可能应用程序池没有权限,或者可能上载方法不受支持,是使用put还是post?我没有在IIS上运行我的应用程序。它运行在asp.net开发服务器上,使用post方法安装了iisexpress吗?可能值得运行它,看看它是否是对dev envs web服务器的限制。是的,安装了iisexpress如果您查看项目属性,请查看“web”选项卡,打开iisexpress,然后重试。您是否尝试使用fiddler跟踪请求和响应?405是否不允许使用iirc方法,可能应用程序池没有权限,或者可能不支持上载方法,是否使用put或post?我没有在IIS上运行我的应用程序。它运行在asp.net开发服务器上,使用post方法安装了iisexpress吗?可能值得运行它,看看它是否是对dev envs web服务器的限制。是的,安装了iisexpress如果您查看项目属性,请查看“web”选项卡,打开iisexpress,然后重试。您是否尝试过使用fiddler跟踪请求和响应?