问题描述
代码如下:
家庭控制器
-------------
the code is given below
home controller
-------------
public ActionResult Uploadi()
{
return View();
}
public ActionResult Upload()
{
var file = Request.Files["Filedata"];
string savePath = Server.MapPath(@"~\Content\" + file.FileName);
file.SaveAs(savePath);
return Content(Url.Content(@"~\Content\" + file.FileName));
}
}
查看
-----
< script type =text / javascript>
$(document).ready(function( ){
$(function(){
$('#file_upload')。uploadify({
'swf':@ Url .Content(〜/ Content / Uploadify / uploadify.swf),
'uckoutImg':@ Url.Content(〜/ Content / Uploadify / uploadify-cancel.png) ,
'uploader':@ Url.Action(Upload,Home),
'onUploadSuccess':function(file,data,response){
$(#uploaded)。append(< img src ='+ data +'alt ='Uploaded Image'/>);
}
});
});
})
;
< / script>
view
-----
<script type="text/javascript">
$(document).ready(function () {
$(function () {
$('#file_upload').uploadify({
'swf': "@Url.Content("~/Content/Uploadify/uploadify.swf")",
'cancelImg': "@Url.Content("~/Content/Uploadify/uploadify-cancel.png")",
'uploader': "@Url.Action("Upload", "Home")",
'onUploadSuccess': function (file, data, response) {
$("#uploaded").append("<img src='" + data + "' alt='Uploaded Image' />");
}
});
});
})
;
</script>
点击选择文件上传文件。
< input type =filename =file_uploadid =file_upload />
Click Select files to upload files.
<input type="file" name="file_upload" id="file_upload" />
请帮帮我
pls help me
推荐答案
这篇关于如何删除uploadify图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!