Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 21544
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: TOMSON [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Fileupload Documentation for Binary Fields wrong
In the section you read: # Copy a binary file to somewhere safe open (OUTFILE,">>/usr/local/web/users/feedback"); while ($bytesread=read($filename,$buffer,1024)) { print OUTFILE $buffer; } but I think it should be: # Copy a binary file to somewhere safe open (OUTFILE,">>/usr/local/web/users/feedback"); while ($bytesread=read($filename,$buffer,1024)) { binmode(OUTFILE); print OUTFILE $buffer; }
On Mon Sep 18 06:38:18 2006, TOMSON wrote: Show quoted text
> In the section you read: > > # Copy a binary file to somewhere safe > open (OUTFILE,">>/usr/local/web/users/feedback"); > while ($bytesread=read($filename,$buffer,1024)) { > print OUTFILE $buffer; > } > > but I think it should be: > > # Copy a binary file to somewhere safe > open (OUTFILE,">>/usr/local/web/users/feedback"); > while ($bytesread=read($filename,$buffer,1024)) { > binmode(OUTFILE); > print OUTFILE $buffer; > }
In 3.43, we have related documentation which I consider sufficient: "If you are using CGI.pm on a Windows platform and find that binary files get slightly larger when uploaded but that text files remain the same, then you have forgotten to activate binary mode on the output filehandle. Be sure to call binmode() on any handle that you create to write the uploaded file to disk." Non-Windows platforms don't require the binmode() call, so the example is accurate for many.