Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with MIME::Base64 and Excel files

Posted on 2004-10-08
3
Medium Priority
?
711 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 375 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
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

715 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