Solved

Problem with MIME::Base64 and Excel files

Posted on 2004-10-08
3
654 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
Comment Utility
Hi twist_,

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

Cheers!
0
 

Author Comment

by:twist_
Comment Utility
D'oh nice one!

0
 
LVL 8

Expert Comment

by:inq123
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now