[英]How to integated plupload into asp.net MVC2 project
我嘗試在asp.net MVC2項目中使用plupload,可以嗎? 如果可以,請幫助我。
最好的祝福!
它與普通文件上傳相同,但我喜歡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));
}
我沒有更改密碼,但是如果您需要任何其他幫助,請詢問,我會解釋
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.