C# 如何将plupload集成到asp.net MVC2项目中
我尝试在我的asp.net MVC2项目中使用plupload,可以吗? 如果可以的话,请帮助我C# 如何将plupload集成到asp.net MVC2项目中,c#,asp.net-mvc-2,plupload,C#,Asp.net Mvc 2,Plupload,我尝试在我的asp.net MVC2项目中使用plupload,可以吗? 如果可以的话,请帮助我 致以最良好的祝愿 它与普通文件上传相同,但我喜欢plupload,我将在我的项目中使用它,因此以下代码将与plupload一起使用 [HttpPost] public ActionResult Create(FormCollection collection) { // my project need single file upload so i get the f
致以最良好的祝愿 它与普通文件上传相同,但我喜欢plupload,我将在我的项目中使用它,因此以下代码将与plupload一起使用
[HttpPost]
public ActionResult Create(FormCollection collection)
{
// my project need single file upload so i get the first file
// also you can write foreach statement to get all files
HttpPostedFileBase postedFile = Request.Files[0];
Image image = new Image();
if (TryUpdateModel(image))
{
fRepository.AddImage(image);
fRepository.Save();
// Try to save file
if (postedFile.ContentLength > 0)
{
string savePath = Path.Combine(Server.MapPath("~/Content/OtelImages/"), image.ImageID.ToString() +
Path.GetExtension(postedFile.FileName));
postedFile.SaveAs(savePath);
// Path for dbase
image.Path = Path.Combine("Content/OtelImages/", image.ImageID.ToString() +
Path.GetExtension(postedFile.FileName));
}
我没有更改代码,但是如果您需要任何进一步的帮助,请询问,我会解释您好,谢谢您的帮助。我之前已经读过一些关于这方面的文章,但是我不能让plupload在我的MVC2项目中运行。请给我更多的细节。非常感谢。嗨,Ryan,不客气,我从我以前的项目中得到了这个代码,我想它会有用的。但是plupload需要ajax交互,所以我将为plupload编写一个代码,它可能会更有效。所以请让我知道它是否有效,因为我的桌面电脑没钱了。我不能尝试i c0demaster,我的项目需要包含哪个库或文件?请帮我编写查看页面的代码。这里有一个mvc平台的工作示例,正如我所说,我不能尝试它,我会在我的桌面计算机上尝试