Solved

Problem with MIME::Base64 and Excel files

Posted on 2004-10-08
3
668 Views
Last Modified: 2008-01-09
Hi

I am attempting to use MIME::Base64 to encode some excel files to Base64.  I am using the following method:

$fileNameIn = "c:\test.xls";
   
       open(fileIn, $fileNameIn) or die("Can't open file $!");

        while (read(fileIn, $buf, 60*57))
        {
                $base64String .= encode_base64($buf);
        }
       
        close(fileIn);


This works fine for text files or bitmap files but when I try to use it for Excel (or Word) files,  it causes no errors but I get hardly any output.

e.g. 100mb excel file comes out as: 0M8R4KGx
0
Comment
Question by:twist_
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
inq123 earned 125 total points
ID: 12260137
Hi twist_,

I don't have the experience but does it help if you open with binmode?

Cheers!
0
 

Author Comment

by:twist_
ID: 12260269
D'oh nice one!

0
 
LVL 8

Expert Comment

by:inq123
ID: 12260402
Hi, twise_, thanks for the points!  While I'm perfectly happy with the points, I want to note that sometimes some experts would want a grade A if the solution is correct and there's no incorrectness/negative things on the solution.  I learned of it after I think someone pointed to EE grading guide or something.

Not to be asking for points for myself as again, I'm perfectly happy.  But for other questions you could consider the guideline.

Best wishes!
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

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 …
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

773 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