Step2: Insert new record to db
$session = JFactory::getSession();
$objectUpload = new stdClass();
$objectUpload->Id = null;
$objectUpload->machine_id = UploadHelper::getMachineId();
$objectUpload->file_list = json_encode([$attachment]);
$objectUpload->session_token = $session->getId();
$objectUpload->attachment_key = $attachmentKey;
$objectUpload->attachment_type = $attachmentType;
$objectUpload->status = $isInitialize == 'true' ? 0 : 4;
$objectUpload->add_timestamp = time();
$result = JFactory::getDbo()->insertObject('#__upload_queue', $objectUpload, 'Id');
This is a known problem and sould be resolved with 3.5.1
You can also apply this patch here: aa99b10