Reputation: 41
i am a newbie in ASP.net MVC3 application. I am working on this project where i have to work with PDF files. I must be able to upload the PDF files to my file server and as soon as the file is uploaded the user must be able to see the preview of the uploaded document on the same page. the Preview must be loaded in some DIV or partial view. I have been spending a lot of time in research but still could not get what i need. If anyone can help m with this i'll be very grateful.
Upvotes: 2
Views: 1937
Reputation: 2678
public class FileUploadController[HttpPost]{
public ActionResult UploadFile(HttpPostedFileBase uploadFile){
//Save file to server
return new FileContentResult(fileContents, contentType);
}
}
@using (Html.BeginForm("UploadFile", "FileUpload", FormMethod.Post, new { enctype = "multipart/form-data" })){
<input type="file" name="uploadFile" id="uploadFile" />
<input type="submit" name="FileUpload" value="Upload" id="FileUpload"/>
}
Upvotes: 2