Flash Upload File with ASP.NET

Uploading file from Flash to PHP through FileReference is fairly simple.

move_uploaded_file($_FILES[’Filedata’][’tmp_name’], $_FILES[’Filedata’][’name’]);

You can easily find it in any Flash upload file related tutorials or posts. But I spend almost one hour searching for a solution of how to upload file from Flash to ASP.NET.

dim myFile as HttpPostedFile=Request.Files(0)
myFile.SaveAs(Server.MapPath(myFile.FileName))

That’s it. Seems fairly simple. It’s in VB and the C# version you can get from The Algorithmist

It looks like something like this:

foreach(string fileKey in _context.Request.Files)
{
HttpPostedFile file = _context.Request.Files[fileKey];
file.SaveAs(Path.Combine(uploadDir, file.FileName));
}

  1. Jay

    Thanks!! That is exactly what I was looking for.

  2. Michiel

    This is great, it’s simple, the way it should be done!

Leave a Reply

For spam filtering purposes, please copy the number 1351 to the field below: