On Tuesday 07 May 2002 14:14, David Freeman wrote:

> I guess that anything that causes this sort of thing to happen on the
> browser is going to help.  I know I'd be fairly unimpressed if I sat
> waiting for a 2MB file to upload only to find that the limit is 1.5MB or
> some such.  At least if a client-side limit is given the browser can do
> something about it.
>
> Not that I actually recall testing that either - I've so far only used
> file upload capabilities on intranet projects where I have fully
> switched 100MB and the like.

Hmm, after a bit of testing I find that the MAX_FILE_SIZE tag is useless to 
say the least (probably because no browsers support it?)

In all of NN, Opera, IE having the tag does /not/ prevent the file from being 
uploaded. Thus if I set MAX_FILE_SIZE to 100000 (100K) and upload a 5MB file 
what happens is:

1) you still have to wait for the whole 5MB to be uploaded
2) php sees the MAX_FILE_SIZE setting is exceeded then discards the file

If anyone wants to run their own tests here's my test script:

======================================================================
<html>
  <body>
    <form enctype="multipart/form-data" action="<? echo $z_PHP_SELF ?>" 
method="post">
      <input type="hidden" name="MAX_FILE_SIZE" value="1000000">
      <table border='0'>
        <tr valign="top">
          <td align="right">Gimme a file</td>
          <td align="left"><input type="file" name="file" size=60></td>
        </tr>
      </table>
      <input type="submit" name="action" value="GO">
    </form>
<?
    $file_size     = $HTTP_POST_FILES['file']['size'];
    $tmp_filename  = $HTTP_POST_FILES['file']['tmp_name'];
    print_r($HTTP_POST_FILES);
?>
  </body>
</html>
======================================================================

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
You just wait, I'll sin till I blow up!
                -- Dylan Thomas
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to