in reply to FIle Upload Error Help!

The first argument of read should be a file handle. You give a string as first argument.

Replies are listed 'Best First'.
Re^2: FIle Upload Error Help!
by Anonymous Monk on Jul 21, 2011 at 19:15 UTC
    But at this point in read if I use the file handle it will have no value because the image file is in $img</cope> and not in the <code>$filename variable. How would you do it?
      I've no idea what is in $img, other than it's a string. Perhaps all you want is:
      $url = new URI::URL($urls); $req = new HTTP::Request('GET', $url, $hdrs); $ua = new LWP::UserAgent; $resp = $ua->request($req); if ($resp->is_success) { open(IMAGE, ">../../img/$filename") or die "$!"; binmode IMAGE; print IMAGE $resp->content; }
      But then you may want to use LWP::Simple instead.
        That I know works, I tried as well but I would like to read this image file before using the code inside of the while loop. Just in case the image been uplaoded is too big. The $img has the image itself from the urls.