So something like my below function isn't going to work because the file HAS
to be uploaded temporarily for it to fopen? The ONLY possible way to check
it is with javascript then? Anyone know where I could find some code to do
that?

$maxbytes=500;

   function ImageSizeCheck($img,$maxbytes,&$arewegood,&$size) {

      $fp = fopen($img, "r");
      $first_file_size_read = fread($fp, $maxbytes + 1);
      fclose($fp);

      if(strlen($first_file_size_read) > $maxbytes) {

         $arewegood="0";
         $size=strlen($first_file_size_read)-1;

      } else {

         $arewegood="1";
         $size=strlen($first_file_size_read)-1;

      }

   }


"Marco Tabini" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Mon, 2003-02-17 at 21:44, Nate wrote:
> > Does this mean the file was examined by the browser and it determined it
was
> > too large OR does it have to upload the file temporarily and then check
to
> > see if its too large?
> >
> > It sounds like browser would first examine the file before it gets
uploaded,
> > however, if I try to upload a 1mb file it takes noticably longer to
produce
> > an error than say a 501 byte file.
> >
> > Please anyone that can help me with this I would really appreciate it.
>
> The browser *should* check but it doesn't. In fact, the limit that's
> being exceeded is probably the one set in your php.ini configuration
> file. In any case, it's generally a bad idea to trust the client with
> performing any checks for anything other than the convenience of the
> user, because it's very easy for a malicious user to send out a request
> that contains completely arbitrary data ignoring completely all the
> controls that are built into your HTML file.
>
> Cheers,
>
>
> Marco
> --
> ----------------
> php|architect - The Monthly Magazine for PHP Professionals
> Come check us out on the web at http://www.phparch.com!
>



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

Reply via email to