Solved

Problem with MIME::Base64 and Excel files

Posted on 2004-10-08
3
688 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_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
transpose into pipe delemited 8 86
Move Function in Perl Script 2 85
what are these modules in perl script 4 109
Perl string filter 5 88
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…

734 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