Hi,
I have followed this article to upload images to my SingleRecord Form, it worksB[/B], my next step is to be able to send those images via email, so I have created a PHP button for it.
I have tried to print {image} value, but I realized it’s an array, I tried again with print_r({image}), and… the array content is just [ 0 => ] 1
So I don’t think this variable would be useful to me… Let’s try getting it from database…
sc_lookup(images, "SELECT binaryvalue FROM files_table WHERE userid = {id}");
Ok, now I got an array with the image content in blob format, I have tried to just attach it contents, also to attach it as base64:
//$attach = {images[0][0]};
$attach = base64_encode({images[0][0]});
sc_mail_send("****", "****", "****", "****", $mail_to, $mail_subject, $mail_body, "H", "", "", "", "", $attach);
in any case, it takes about 20 seconds to process it and then it gives me the following error:
Not using base64:
Fatal error[SIZE=13px]: in [/SIZE]/home/*****/web/*******/public_html/scriptcase/prod/third/swift/classes/Swift/ByteStream/FileByteStream.php[SIZE=13px] on line [/SIZE]143
Using base64:
Fatal error[SIZE=13px]: Uncaught exception ‘Swift_IoException’ with message 'Unable to open file for reading [blabla bla base64 string bla bla] in [/SIZE]/home/*****/web/*******/public_html/scriptcase/prod/third/swift/classes/Swift/ByteStream/FileByteStream.php[SIZE=13px] on line [/SIZE]143
Any tips?
B [/B]Uploading images work, but filename is not stored in database, it’s always NULL, how could I fix it?
EDIT: Apparently, sc_mail_send macro tries to open a file when I’m giving content, not a path… is there any way to upload files to server instead of storing it in database? so I would just store filename in database.
Thanks, best regards.