PDA

View Full Version : Perl Binmode()


Sephiroth
01-23-2003, 09:24 PM
I've got a perl script called Elite Web Page Builder... everything in it works except for the upload functions on Windows servers, I know the problem lies in binmode() somewhere.... but I don't know enough perl to find where the problem is and how to fix it. Can someone help? Everytime you upload a binary file on a Win32 box through it the binary file is corrupted :(

chrisvmarle
01-23-2003, 10:14 PM
I've installed the script (found it on http://www.elitehosts.com/scripts/main.htm).
I have no problems at all...

I don't know what your problem is, but it's not BINMODE.
(I've running Windows too)

Mzzl, Chris

P.S. I know this doesn't really solves your problem, but I just wanted to let you know

Sephiroth
01-23-2003, 10:18 PM
weird... it does this both on my box and my school's webserver i'm trying to fix the script for, i had a friend look at an original file and one uploaded through there and it's crlf translation that is corrupting bytes in part of the file

chrisvmarle
01-23-2003, 10:35 PM
Guess your right, didn't look good, was trying to be too fast :(

Sorry

Same prob. I'll have a look @ the code

Sephiroth
01-23-2003, 10:37 PM
no prob.. and thanks

it's a perfect solution for what my school needs to do... and i'm pretty good friends with the head tech there, and he couldn't fix it so he asked me to try, and now i'm pulling my hair out lol

chrisvmarle
01-23-2003, 10:50 PM
On line 3551 I've changed
open(FILE,"> $usrdir$cd$filename");
print FILE "$in{'upfile1'}";
close(FILE);

to:
open(FILE,"> $usrdir$cd$filename");
binmode(FILE);
print FILE "$in{'upfile1'}";
close(FILE);

And I've added binmode(FILE); on the lines 3617 3685 and 3754.

Though it only seems to fix the "corruption" problem on some files, the only file that got uploaded correctly was a GIF89a...

I don't think I can help you further on this; anyone else?

Mzzl, Chris