I have to download zipped image from image URL path. Downloading image is clear. But problem is that prompt window is not appearing i.e. FileStreamResult returns nothing.
Asp.NET MVC controller post method:
[AcceptVerbs(HttpVerbs.Post)]
public FileResult Extract(string[] name)
{
using (ZipFile zip = new ZipFile()) //Zip section
{
foreach (var item in name)
{
string exts = Path.GetExtension(item);
string strRealname = Path.GetFileName(item);
using (WebClient client = new WebClient()) // download Section
{
client.DownloadFile(item, Server.MapPath("~/upload/") + strRealname + exts);
}
string filePath = Server.MapPath("~/upload/" + strRealname + exts);
zip.AddFile(filePath, Path.GetFileName(filePath));
}
string dest = Server.MapPath("~/Album.zip");
zip.Save(dest);
byte[] data = System.IO.File.ReadAllBytes(dest);
var strm = new FileStream(dest, FileMode.Open);
//return new FileStreamResult(strm, "application/zip")
return new FileContentResult(data, "application/zip");//Not showing prompt window
}
}
My problem is that return FileStreamResult is not working - why? I have tried too much but not succedded. The values of string[] name is obtained by using Ajax\JqueryUI post method .Actually the values are checkBox's value those are checked .