PostedFile.SaveAs gives me 0KB file size ?

Discussion in 'ASP.NET 2.0' started by wisemx, Nov 18, 2007.

  1. Here's a method I use to upload an image and then display it with other images that were uploaded:
    Replace ~/server/file_upload/ with your servers path.

     
  2. Hi all
    I have a strange situation here
    I try to upload some pictures onto the server. Up to 3 days ago, it was uploading perfectly. Then I noticed that every time I upload a pic, it gets uploaded with a 0kb size. I am almost 100% sure that It is not coming from my code because it is working fine on my localhost. On my localhost I upload the file without any problems.
    I use the HttpPostedFile SaveAs method to do so.
    string photosPath = HttpContext.Current.Server.MapPath(CConfig.GetMembersPhotosPath());
    postedFile.SaveAs(photosPath + '\\' + newFileName);

    And what I find disturbing in all this is that after uploading, it is supposed to update the database with the new pic record. It fails to do so on the server, but works fine on my localhost.
    The funny thing is that I placed all this in a try and catch block, and the catch is supposed to send me an email motification of any errors occuring on the server, there again, no error reported whatsoever

    PLease help, Im very desperate on this

    Thanks
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    Also check your aspnet user quota in the hosting control panel's user/quota manager. If the aspnet user do not have enough quota, you'll see a file w/ 0k size.


    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     

Share This Page