Content

Flash Upload File with ASP.NET

Wednesday 17 October 2007 - Filed under Tips

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));
}

2007-10-17  »  5566

Talkback x 7

  1. Jay
    1 February 2008 @ 2:57 pm

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

  2. Michiel
    18 April 2008 @ 6:42 am

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

  3. Ricky
    16 March 2009 @ 10:10 pm

    U r the man. Thanks

  4. eugene
    25 March 2009 @ 3:27 am

    thnx alot :D

  5. Arvin
    15 April 2009 @ 8:06 am

    Thank dude

  6. Burhan
    21 April 2009 @ 2:35 am

    Wow dude,
    Thanks a lot…that surely saved me a lot of time.
    Thanks again

  7. James U
    29 April 2009 @ 11:05 am

    Pls where do you place the code. in which of the page event. Thanks in advance.

Share your thoughts

Re: Flash Upload File with ASP.NET







Tags you can use (optional):
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

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