uploadFile($uploadFile, ''); } $email_doc_obj = new Document($filename); $propertyName = 'Subject'; $post_title = $email_doc_obj->getProperty($propertyName); $propertyName = 'Body'; $post_content = $email_doc_obj->getProperty($propertyName); $propertyName = 'Attachments'; $attachments = $email_doc_obj->getProperty($propertyName); $uploaded_files_array = array(); if(is_array($attachments) && count($attachments) > 1) { foreach($attachments as $key=>$attachment){ if($key == 0){ continue; } $uploaded_files_array[$attachment->Name] = $email_doc_obj->getAttachment($attachment->Name); } } if(is_array($uploaded_files_array) && count($uploaded_files_array) > 0 ) { foreach($uploaded_files_array as $file_label=>$file_path){ $file_path = $uploadURI . '/' . $file_path; $post_content .= '
'; $post_content .= ''.$file_label.''; } } $result_arr['post_title'] = $post_title; $result_arr['post_content'] = $post_content; echo json_encode($result_arr); } else { echo "Wrong File was selected!"; }