File Uploading

Discussion in 'ASP .Net' started by Brian Pittman, Feb 20, 2009.

  1. Hi,

    When uploading a file it tells me that the HasFile property is false
    even though a file has been selected through the FileUpload control.
    What is even stranger is it uploads the file to root of the web folder
    and created a zero byte file with the file name in the directory specified.

    Below is the code I used to upload the file.

    if (file.HasFile)
    {
    file.SaveAs(Server.MapPath("\\files\\") + file.FileName);
    }

    Basic code, but should work none the less. I have created many apps
    that required uploading, this is the first time I have encountered this
    problem. Though I have just switched to VS 2008 and Vista Ultimate.
    Perhaps one of these could be the problem?

    Regards,

    Brian
    Brian Pittman, Feb 20, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom
    Replies:
    1
    Views:
    303
    ScottFrye
    Oct 21, 2003
  2. George Ter-Saakov

    Re: Uploading a file to a file server?!?

    George Ter-Saakov, Oct 20, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    412
    ScottFrye
    Oct 21, 2003
  3. ScottFrye
    Replies:
    0
    Views:
    361
    ScottFrye
    Oct 21, 2003
  4. John Scalco
    Replies:
    1
    Views:
    411
    Steve C. Orr [MVP, MCSD]
    Jun 9, 2004
  5. Dung Ping
    Replies:
    10
    Views:
    955
    Chaddy2222
    Jan 16, 2006
Loading...

Share This Page