how to check size of file before upload to serevr

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vishal

    how to check size of file before upload to serevr

    hi

    is there anyway that i can check the size of file on client side before
    uploading file to server????

    suppose the user uploads file of 10 mb then the server will know the
    size is 10 mb after the file is uploaded to server which wastes the
    bandwidth so what i want to check is that the server first checks the
    size of file to upload and if it is
    o.k. then and then only the file will be uploaded..


    thxs for reply in advance......

  • Aidan

    #2
    Re: how to check size of file before upload to serevr


    "vishal" <vishal_panjabi @yahoo.co.in> wrote in message
    news:1113891237 .917947.160880@ o13g2000cwo.goo glegroups.com.. .[color=blue]
    > hi
    >
    > is there anyway that i can check the size of file on client side before
    > uploading file to server????
    >
    > suppose the user uploads file of 10 mb then the server will know the
    > size is 10 mb after the file is uploaded to server which wastes the
    > bandwidth so what i want to check is that the server first checks the
    > size of file to upload and if it is
    > o.k. then and then only the file will be uploaded..
    >
    >
    > thxs for reply in advance......[/color]


    AFAIK, it's not possible to do this in PHP, since it's a server-side
    scripting language. In other words, PHP can only find the size of the file
    _after_ it has been uploaded. To check the size of the file be fore it is
    uploaded, you'll need to employ a client-side scripting language, such as
    JavaScript, and create a condition that the file must be under a certain
    size, or it will not be uploaded.

    HTH


    Comment

    • \(¯`·..Yttrium ...·´¯\)

      #3
      Re: how to check size of file before upload to serevr

      "vishal" <vishal_panjabi @yahoo.co.in> a écrit dans le message de news:
      1113891237.9179 47.160880@o13g2 00...legr oups.com...
      [color=blue]
      > is there anyway that i can check the size of file on client side before
      > uploading file to server????[/color]

      Hello,
      Certainly not with php !
      But perharps with Javascript.
      Bye


      Comment

      Working...