- Edited
I have a WordPress site where I am using a plugin called Formidable Forms. I have created this form and used an action hook to post to the osTicket API, which works with the exception of attachments. The attachments are uploaded to a Amazon S3 bucket before the form is submitted. Every time a ticket is created, there is no attachment. I did error checking and haven't come up with anything. When you've been looking at code for hours, you need an extra pair of eyes to see what you are doing wrong. Any help is greatly appreciated. Below is the attachment portion of my code. if ($form_id == 11) { $debug = "0"; $config = array( 'url' => 'https://example.com/api/tickets.json', // URL to site.tld/api/tickets.json 'key' => 'secretykeypslsiw' // API Key goes here ); $attachArray = array(); for ($i = 0; $i < count($_FILES); $i++) { $name = $_FILES; $type = mime_content_type($_FILES); } $month = date('m'); $day = date('d'); for($x=0;$x<count($name);$x++) { $attachArray = array( $name => "data:$type;base64;" . base64_encode(file_get_contents("https://s3.amazonaws.com/my-assets/wp-content/uploads/$month/$day/$name")) ); } $data = array( 'attachments' => $attachArray ); }