Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is not clear what you want to save. In a web application you could use the file input to upload files to the server:</p> <pre><code>&lt;input type="file" name="file" /&gt; </code></pre> <p>For more information about uploading files in an ASP.NET MVC application you may take a look at the <a href="https://stackoverflow.com/questions/5193842/file-upload-asp-net-mvc-3-0/5193851#5193851"><code>following post</code></a>.</p> <p>If on the other hand you want the user to be able to download some file from the server and prompted for the location where he wants to save this file you could return a File result from a controller action and specify the MIME type and filename:</p> <pre><code>public ActionResult Download() { var file = Server.MapPath("~/App_Data/foo.txt");\ return File(file, "text/plain", "foo.txt"); } </code></pre> <p>There are also other overloads of the <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.file%28v=vs.98%29.aspx" rel="nofollow noreferrer"><code>File</code></a> method that allow you to dynamically generate a file and pass it as a stream to the client. But the important part to understand in a web application when downloading a file from a server is the <code>Content-Disposition</code> header. It has 2 possible values: <code>inline</code> and <code>attachment</code>. For example with the above code the following header will be added to the response:</p> <pre><code>Content-Type: text/plain Content-Disposition: attachment; filename=foo.txt ... contents of the file ... </code></pre> <p>When the browser receives this response from the server it will prompt the user with a Save As dialog allowing him to choose the location on his computer to store the downloaded file.</p> <hr> <p>UPDATE:</p> <p>Here's how you could achieve similar in a web application:</p> <pre><code>public ActionResult Download() { var file1 = File.ReadAllLines(Firstfilpath); var file2 = File.ReadAllLines(2ndfilpath); var mergedFile = string.Concat(file1, file2); return File(mergedFile, "text/plain", "result.txt"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload