通过jquery asp.net mvc 3.0上载图像时出错
我需要上传一个图像到服务器。该项目使用.NETMVC、jQuery和jQueryUi。 错误显示:IO错误 你们能帮我解决这个错误吗 我的代码如下: 我的项目中包含了这些指令。通过jquery asp.net mvc 3.0上载图像时出错,jquery,asp.net-mvc-3,Jquery,Asp.net Mvc 3,我需要上传一个图像到服务器。该项目使用.NETMVC、jQuery和jQueryUi。 错误显示:IO错误 你们能帮我解决这个错误吗 我的代码如下: 我的项目中包含了这些指令。 <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/js/jquery-1.7.1.min.js")" type=
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/js/jquery-1.7.1.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/custom-theme/jquery-ui-1.8.18.custom.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="@Url.Content("~/Scripts/js/jquery-ui-1.8.18.custom.min.js")"></script>
<link href="@Href("~/Content/uploadify.css")" rel="stylesheet" />
<script src="@Href("~/Scripts/jquery.uploadify.js")" type="text/javascript"></script>
html:
$(window).load(
function() {
$("#fileuploader").fileUpload({
'uploader': '/Scripts/uploader.swf',
'cancelImg': '/images/cancel.png',
'buttonText': 'Select Image',
'script': 'ShowClientQuotation/Upload',
'folder': '/images',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'multi': false,
'auto': true
});
}
);
<div id="fileuploader"></div>
仅JS代码中的更改:
$(window).load(
function() {
$("#fileuploader").fileUpload({
'uploader': '/Scripts/uploader.swf',
'cancelImg': '/images/cancel.png',
'buttonText': 'Select Image',
'script': "@Url.Action("ShowClientQuotation", "upload")",
'folder': '/images',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'multi': false,
'auto': true
});
}
);
修改后,我的代码运行得很好。
谢谢大家。您的行动是否因此而受到影响?我认为您必须在上载操作的顶部添加[httppost]属性。“图像”是否具有写入权限?为什么将此处理程序附加到窗口的on load事件而不是document.ready事件上?@Rob Angelier:b/c我有一个示例项目,在其中,他们使用windows.Load如果您想在线查看我从何处下载此代码的示例代码:
$(window).load(
function() {
$("#fileuploader").fileUpload({
'uploader': '/Scripts/uploader.swf',
'cancelImg': '/images/cancel.png',
'buttonText': 'Select Image',
'script': "@Url.Action("ShowClientQuotation", "upload")",
'folder': '/images',
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
'multi': false,
'auto': true
});
}
);