Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Porting an image upload script Linux to W2K

Posted on 2003-03-17
4
Medium Priority
?
208 Views
Last Modified: 2010-03-05
Can someone tell me from the code chunk below if there is an obvious reason why the image upload script I have been using works fine on Linux/Apache but not on W2K/IIS? I have included the few lines of script that do the actual work of creating the image file on the remote server - the script runs fine but corrupts the image on upload. This is not consistant - sometimes the image won't display in the browser, sometimes it appears but is visibly messed up, plus the OS can never report it's properties.



open (OUTFILE, ">$basedir/$fileName")||die(print "can't open");

while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close (OUTFILE);
}


Any help much appreciated.

Stu
0
Comment
Question by:stusbikeshed
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
rj2 earned 800 total points
ID: 8153989
Add the line below after open
binmode(OUTFILE);
0
 
LVL 10

Expert Comment

by:rj2
ID: 8154003
Linux don't have separate binary mode and text mode.
Windows does.
0
 
LVL 2

Expert Comment

by:SegFault
ID: 8158224
the file seperator in windows is "\", in unix its "/"

that could be part of your problem too.

seg
0
 

Author Comment

by:stusbikeshed
ID: 8168598
Thanks RJ2!

I've not had a chance to check it yet but I had a thought that this could be the problem too. Your confirmation earns 200 points. Thanks again.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question