develooper Front page | perl.beginners | Postings from May 2019

can I use some kind of binary string?

Thread Next
From:
hwilmer
Date:
May 10, 2019 17:10
Subject:
can I use some kind of binary string?
Message ID:
3be584aa-4c95-e440-60f9-e0ff31dd676b@gc-24.de

Hi,

I would like to use curl to retrieve an image from a web server which I 
want to store in a table in a mariadb database without downloading the 
image to a file.  For this application, I do not want to store 
references to files stored in some file system instead.

So I would want to use something like


my $binary_data = `curl -k "https://www.example.com/some.jpg"`;


The image then needs to be inserted into a LONGBLOB field via DBI in 
such a way that the image can be restored as it was.

Will string conversions or something prevent this from working?

What is the usual way to do this?  It is certainly not ideal to have no 
check on the amount of data that might be retrieved from the web server, 
regardless whether I save it to an intermediate file or not.

To make things more difficult, the web server is using a self-signed 
certificate.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About