Getting FileSize

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deepikashalini
    New Member
    • Mar 2008
    • 18

    Getting FileSize

    Hi,


    i have small problem. upload a file how to get the file size.


    code:


    private static string getFileName(Htt pContext web, string fieldName)
    {
    try{
    //HttpPostedFile file = web.Request.Fil es[web.Request["attachedFi le"]];

    HttpPostedFile file = web.Request.Fil es[fieldName];
    if(file!=null) {

    return System.IO.Path. GetFileName(fil e.FileName);
    }else{
    return "";
    }
    }catch(Exceptio n e){
    return "";
    }
    }


    how to get file size in this function. pls give me any solutions
  • balabaster
    Recognized Expert Contributor
    • Mar 2007
    • 798

    #2
    Dim FileLength As Integer = New System.IO.FileI nfo("FilePath") .Length

    Comment

    • deepikashalini
      New Member
      • Mar 2008
      • 18

      #3
      Originally posted by balabaster
      Dim FileLength As Integer = New System.IO.FileI nfo("FilePath") .Length

      Hi im using fileinfo("fileP ath") but not working. give sample code for getting the filesize for upload the text.

      Comment

      • balabaster
        Recognized Expert Contributor
        • Mar 2007
        • 798

        #4
        Looking back over your code, it doesn't make sense to me - what are you trying to achieve?

        Comment

        Working...