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. JavaScript
  4. determine file size before uploading?

determine file size before uploading?

Scheduled Pinned Locked Moved JavaScript
javascriptquestion
7 Posts 5 Posters 2 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.
  • G Offline
    G Offline
    Gofur Halmurat
    wrote on last edited by
    #1

    Hello, I would like to ask, is there any way to determine file size before uploading with javascript? thanks

    It is never late to learn

    T P T 3 Replies Last reply
    0
    • G Gofur Halmurat

      Hello, I would like to ask, is there any way to determine file size before uploading with javascript? thanks

      It is never late to learn

      T Offline
      T Offline
      twseitex
      wrote on last edited by
      #2

      Helo, don't make javascript able to read file (informations) locally (on client) !! Better: Use PHP or other serverside functions to get filesize. Cu.

      P 1 Reply Last reply
      0
      • T twseitex

        Helo, don't make javascript able to read file (informations) locally (on client) !! Better: Use PHP or other serverside functions to get filesize. Cu.

        P Offline
        P Offline
        Peter_in_2780
        wrote on last edited by
        #3

        No! If he wants to UPload a file, it's on the client, so the client is the right place to find out the size. See my answer to OP for more info. Peter

        Software rusts. Simon Stephenson, ca 1994.

        1 Reply Last reply
        0
        • G Gofur Halmurat

          Hello, I would like to ask, is there any way to determine file size before uploading with javascript? thanks

          It is never late to learn

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #4

          The JavaScript security model does not allow access to the client's file system, so there is no direct way. You can use either an ActiveX object X| or a Java applet X|. Either way, you'll need the user's permission. Google for "javascript file size" and you'll find some discussions of the problem. Cheers, Peter

          Software rusts. Simon Stephenson, ca 1994.

          1 Reply Last reply
          0
          • G Gofur Halmurat

            Hello, I would like to ask, is there any way to determine file size before uploading with javascript? thanks

            It is never late to learn

            T Offline
            T Offline
            thatraja
            wrote on last edited by
            #5

            Dirty way by javascript Using javascript check uploaded file size, which is uploaded by a file upload control[^]

            thatraja


            **My Tip/Tricks
            My Dad had a Heart Attack on this day so don't...
            **

            P 1 Reply Last reply
            0
            • T thatraja

              Dirty way by javascript Using javascript check uploaded file size, which is uploaded by a file upload control[^]

              thatraja


              **My Tip/Tricks
              My Dad had a Heart Attack on this day so don't...
              **

              P Offline
              P Offline
              Peter_in_2780
              wrote on last edited by
              #6

              ... which just uses ActiveX

              Software rusts. Simon Stephenson, ca 1994.

              M 1 Reply Last reply
              0
              • P Peter_in_2780

                ... which just uses ActiveX

                Software rusts. Simon Stephenson, ca 1994.

                M Offline
                M Offline
                Manfred Rudolf Bihy
                wrote on last edited by
                #7

                That's probably why Raja said "dirty way". ;)

                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