Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^3: problems with decoding by using base64 method

by derby (Abbot)
on Aug 03, 2016 at 12:12 UTC ( #1169079=note: print w/replies, xml ) Need Help??

in reply to Re^2: problems with decoding by using base64 method
in thread problems with decoding by using base64 method

That was tough to wade through, you should put code in-between <code>...</code> tags. But basically, I see this

my $filePath1 = "/tools/busapps/LAMP/dev/APP/htdocs/APP/APP_Attachment +s/2016/LGop.pdf"; open (my $upload_filehandle,'<',$filePath1); binmode $upload_filehandle; my $filecontents; { local $/ = undef; $filecontents = <$upload_filehandle>; } my $fContent = decode_base64( $filecontents );
and unless your file naming conventions are strange, a pdf file is not base64 encoded.

What you need to do is first identify and isolate a file that is failing to decode. Move it off to the side and then write a very small script that just opens that problem file and tries to decode_base64 it. More than likely, you'll find the problem is with the actual file (it's not base64 encoded) and not the decode_base64 routine.


Replies are listed 'Best First'.
Re^4: problems with decoding by using base64 method
by anil1.perl (Initiate) on Aug 03, 2016 at 12:55 UTC
    Hi Derby, Thanks for your reply. We have created a script & doing what you said as below 1.uploading the encoded file to DB 2.Downloading the file & decoding it. Files which have images/scanned images/headers & footers are not opening but the other files (text) are opened. Any thoughts on this? Regards, Anil
      Did you try to decode an encoded file before it was put in the database? If that works, then your database somehow alters the file between storage and retrieval. If that doesn't work then there is probably something wrong with the encoding.


      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      My blog: Imperial Deltronics
        Thanks for your reply, i want to add one more point here. When we try to view that file using a Java script in UI it is opening properly, only problem is when we download that file using a PERL script to our local path it's not opening. Any idea for this issue? Regards, Anil

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1169079]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2022-12-06 08:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found