fopen() returns FALSE if it fails, and that's probably what happends here.
$_POST is superglobal so register_globals doesn't mean anything to it. Just
use the proper functions for filename and filesize:

$_FILES['userfile']['name']
$_FILES['userfile']['size']

Of course you should move the uploaded file from it temporary location
somewhere in the script. Look "Chapter 18. Handling file uploads" for
further details ...

Misha Peric

"Tyler Longren" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I'm trying to upload a small image via a form.  This code worked with php
> versions prior to 4.1.0.  I assume it would still work if register_globals
> was turned on.
>
> Here's the error:
> Warning: fread(): supplied argument is not a valid stream resource in
> /home/sites/site2/users/tyler/web/upload.php on line 28
>
> And here's line 28:
> $data = fread(fopen($_POST['binFile'], "r"), filesize($_POST['binFile']));
>
> Am I doing that correctly?  If you need to see more code, let me know.
>
> Thanks everyone!
> Tyler Longren
>



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

Reply via email to