Skip to content
archive edited this page Jun 26, 2011 · 4 revisions

One way of handling the upload:

public class UploadController : Controller
{
    [HttpPost]
    public ActionResult Upload(string qqfile) // plus if you have added some other parameters
    {
        // To handle differences in FireFox/Chrome/Safari/Opera
        Stream stream = Request.Files.Count > 0 ? Request.Files[0].InputStream : Request.InputStream;

        TextReader textReader = new StreamReader(stream);
        string line;
        while ((line = textReader.ReadLine()) != null)
        {
            // Yeah
        }
    }
}

Clone this wiki locally