Link to home
Start Free TrialLog in
Avatar of twist_
twist_

asked on

Problem with MIME::Base64 and Excel files

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
ASKER CERTIFIED SOLUTION
Avatar of inq123
inq123

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of twist_
twist_

ASKER

D'oh nice one!

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!