Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: large file uploads - timeout

by perlplexer (Hermit)
on Mar 22, 2003 at 17:34 UTC ( #245179=note: print w/replies, xml ) Need Help??


in reply to large file uploads - timeout

Are you positive that timeouts are to blame?
When you say "a script that is capable of uploading smaller sized files", do you mean to say that you tested it on small text files and it worked?
If so, then the problem is probably related to you not binmode()ing your filehandle...
Try doing this:
open (LOCAL, ">$uploadLocation/$schemedName") or dieNicely("Unable to +upload: $!"); binmode LOCAL; # ... rest of your code

--perlplexer

Update:
And before I forget... make sure you binmode() both filehandles, the one that you opened for writing and the one that you're reading from;i.e., LOCAL and $file. The open() statement for $file is not shown in your code, make sure you call binmode() right after that open()...

Replies are listed 'Best First'.
Re: Re: large file uploads - timeout
by emilford (Friar) on Mar 22, 2003 at 17:41 UTC
    I thought I remember reading somewhere that binmode was just needed for Windows systems and not Unix ones. I have tested the script on smaller (< 70kb) txt, doc, and pdf files and everything works fine. When I try to upload the 1.8MB pdf file is when I get the error. I'll try your suggestion. Thanks.

      With the new input disciplines, utf8 and whatnot in Perl 5.8 even Unixers should get used to binmode(). (And I should reread the docs to be able to tell what exactly happens if they don't.)

      Jenda
      Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
         -- Rick Osborne

      Edit by castaway: Closed small tag in signature

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://245179]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2022-08-17 04:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?