Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. File Size

File Size

Scheduled Pinned Locked Moved ASP.NET
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kuricheti
    wrote on last edited by
    #1

    Hi, I am using File Upload control to upload files. Is there any way to find the size of the file before saving it. Because I want to tell to the end user that 'ur File size exceeded the max limit'. Thanks Hari

    N S 2 Replies Last reply
    0
    • K Kuricheti

      Hi, I am using File Upload control to upload files. Is there any way to find the size of the file before saving it. Because I want to tell to the end user that 'ur File size exceeded the max limit'. Thanks Hari

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      FileUpload1.PostedFile.ContentLength ?

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions

      1 Reply Last reply
      0
      • K Kuricheti

        Hi, I am using File Upload control to upload files. Is there any way to find the size of the file before saving it. Because I want to tell to the end user that 'ur File size exceeded the max limit'. Thanks Hari

        S Offline
        S Offline
        squattyarun
        wrote on last edited by
        #3

        use this : 'flUpload is the name of File Upload control flUpLoad.PostedFile.ContentLength it will return the size of posted file in bytes... :)

        Arun Singh Noida.

        K 1 Reply Last reply
        0
        • S squattyarun

          use this : 'flUpload is the name of File Upload control flUpLoad.PostedFile.ContentLength it will return the size of posted file in bytes... :)

          Arun Singh Noida.

          K Offline
          K Offline
          Kuricheti
          wrote on last edited by
          #4

          Thanks, Is there any way to find the same in button's Clientside click event i.e 'OnClientClick' event Because to avoid unnecessary postback. Thanks Hari -- modified at 5:00 Friday 2nd November, 2007

          A 1 Reply Last reply
          0
          • K Kuricheti

            Thanks, Is there any way to find the same in button's Clientside click event i.e 'OnClientClick' event Because to avoid unnecessary postback. Thanks Hari -- modified at 5:00 Friday 2nd November, 2007

            A Offline
            A Offline
            Arif patel
            wrote on last edited by
            #5

            Try this javacsript.... function A() { var oas = new ActiveXObject("Scripting.FileSystemObject"); var d = document.a.b.value; var e = oas.getFile(d); var f = e.size; alert(f + " bytes"); }

            Arif patel Bangalore

            K 1 Reply Last reply
            0
            • A Arif patel

              Try this javacsript.... function A() { var oas = new ActiveXObject("Scripting.FileSystemObject"); var d = document.a.b.value; var e = oas.getFile(d); var f = e.size; alert(f + " bytes"); }

              Arif patel Bangalore

              K Offline
              K Offline
              Kuricheti
              wrote on last edited by
              #6

              Hi patel I run the above code. I'm getting javascript error at 'var oas = new ActiveXObject("Scripting.FileSystemObject");' saying that 'Microsoft JScript runtime error: Automation server can't create object' What I have to do? Thanks Hari -- modified at 2:42 Monday 5th November, 2007

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups