TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Madhav Sharma
766
899
39.3k
Need help, Not able to download the file
Apr 4 2020 4:50 PM
I have tried to download my file from the directory location but unable to download, and it does not give any error. Is this folder permission issue or something code is missing.
my complete directory path = C:\Users\abc\source\repos\SkylandApplication\WebApp\Upload\Documents\5\FranchiseData\Location\1\70054b29-20f1-438e-9c78-521a34107c9d.jpg
public ActionResult DownloadFranchiseLeftsideImg(CompanyLocationViewModel model)
{
try
{
CompanyLocationViewModel obj = Session["Location"] as CompanyLocationViewModel;
obj.LeftsideImg = model.LeftsideImg;
obj.RightsideImg = null;
obj.InsideImg = null;
obj.OutsideImg = null;
var LeftSideImg = repo_companylayoutlocation.LocationDownloads(obj);
string UploadedPath = System.Configuration.ConfigurationManager.AppSettings["ImagePath"];
string folderName = "FranchiseData/Location/" + obj.LocationId;
String absolutePath = System.Web.Hosting.HostingEnvironment.MapPath(UploadedPath + "\\" + obj.FranchiseId + "\\" + folderName);
string completePath = System.IO.Path.Combine(absolutePath, LeftSideImg);
byte[] fileBytes = System.IO.File.ReadAllBytes(completePath);
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, "LeftSideImg");
//var bytes = System.IO.File.ReadAllBytes(completePath);
//return File(completePath, MimeMapping.GetMimeMapping(completePath), LeftSideImg);
//return File(completePath, "application/force -download", LeftSideImg);
}
catch (Exception ex)
{
throw;
}
Reply
Answers (
2
)
use method in controller from another controller
Diff in ddl.SelectedValue vs ddl.SelectedItem.Value