Uploading one PDF document

13 views
Skip to first unread message

Larene Spitler

unread,
Jan 5, 2015, 4:43:09 PM1/5/15
to guz...@googlegroups.com
What is wrong with my code?

$filename = '/home/familysearch/public_html/fst' . $_POST['story_id'] . '.pdf';
$title = str_replace(" ", "+", $_POST['title']); 
$filelink = 'fst' . $_POST['story_id'] . '.pdf';
$client = new Client();
$response = $client->post($url, [
'headers' => [
'Content-Type' => 'multipart/form-data; boundary=Boundary_5_1593431620_1418337402143',
    'Authorization' => 'Bearer ' . $_POST['access_token'],
    'MIME-Version' => '1.0'
    ],
    'body' => [
        'Content-Type' => 'application/pdf',
        'Content-Disposition' => 'form-data; name="' . $title . '"',
        'pdf_filed' => fopen($filename, 'rb')
    ]
]);
Reply all
Reply to author
Forward
0 new messages