Jquery request download/open file to the user

Posted by CoffeeCode on Stack Overflow See other posts from Stack Overflow or by CoffeeCode
Published on 2010-03-14T19:27:51Z Indexed on 2010/03/14 19:35 UTC
Read the original article Hit count: 420

Filed under:
|
|
|

I have a Url that returns a file. How should my jquery request looklike to download this file to the user??

the action method looks like this

public FileContentResult GetFile(int Id)
        {
            if (Id == 0)
                return File(new byte[0], "");
            Survey survey = Repository.GetItem(Id);
            return File(survey.File.FileContent.ToArray(), survey.File.ContentType, survey.File.Name);
        }

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about jQuery