Quantcast
Channel: ASPRunner forums
Viewing all articles
Browse latest Browse all 2586

[SOLVED] Multiple attachments from one field

$
0
0
Hi Sergey,

I have a table in my project called pdf that has a varchar(2000) field so I can upload files, I want to send an e - mail from my application that has those files included as an attachment or include links to those files so they can be downloaded.

Problem 1: I have used:

$attachments = array
(

array('path' => getabspath('files/'.$values['pdf'].'')

)

But I get an error that the file is not accessbile.

I have changed the "getbspath" to the actual url of the file folder:

array('path' => getabspath('https://mydomain.com/files/'.$values['pdf'].'')

But I still get the same thing,

Now, there are multiple files saved on the same field, so the result of $value['pdf'] is:
'[{"name":"files\/SMM190614KA9_Factura_A13_20200106_0dh45m0m.pdf","usrName":"SMM190614KA9_Factura_A13_20200106.pdf","size":18830,"type":"application\/pdf","searchStr":"SMM190614KA9_Factura_A13_20200106.pdf,!SMM190614KA9_Factura_A11_20200106.pdf,!SMM190614KA9_Factura_A12_20200106.pdf,!:sStrEnd"},{"name":"files\/SMM190614KA9_Factura_A11_20200106_x40w92lv.pdf","usrName":"SMM190614KA9_Factura_A11_20200106.pdf","size":18796,"type":"application\/pdf"},{"name":"files\/SMM190614KA9_Factura_A12_20200106_jq1kxy5t.pdf","usrName":"SMM190614KA9_Factura_A12_20200106.pdf","size":18732,"type":"application\/pdf"}]'

So, I'm guessing that the application is trying to retrieve something like this:

https://mydomain.com/files/'[{"name":"files\/SMM190614KA9_Factura_A13_20200106_0dh45m0m.pdf","usrName":"SMM190614KA9_Factura_A13_20200106.pdf","size":18830,"type":"application\/pdf","searchStr":"SMM190614KA9_Factura_A13_20200106.pdf,!SMM190614KA9_Factura_A11_20200106.pdf,!SMM190614KA9_Factura_A12_20200106.pdf,!:sStrEnd"},{"name":"files\/SMM190614KA9_Factura_A11_20200106_x40w92lv.pdf","usrName":"SMM190614KA9_Factura_A11_20200106.pdf","size":18796,"type":"application\/pdf"},{"name":"files\/SMM190614KA9_Factura_A12_20200106_jq1kxy5t.pdf","usrName":"SMM190614KA9_Factura_A12_20200106.pdf","size":18732,"type":"application\/pdf"}]'

In which case the file will not exist.

I would like to send all the files in that field as an attachment, or, create a link for each one of those files so the user can download them via e - mail.

If I go to https://mydomain.com/files/SMM190614KA9_Factura_A13_20200106_0dh45m0m.pdf, I can actually download the file, which I know now that SMM190614KA9_Factura_A13_20200106_0dh45m0m.pdf is the file name as it's actually stored in the application's file folder, but how can I get those names from all the files that are stored in that particular field?

Viewing all articles
Browse latest Browse all 2586

Trending Articles