You are here

public function SmartlingApi::uploadFile in TMGMT Translator Smartling 8

Uploads original source content to Smartling.

Parameters

string $realPath: Real path to the file to read in into stream.

string $file_name: Value that uniquely identifies the uploaded file. This ID can be used to request the file back.

string $file_type: Unique identifier for the file type. Permitted values: android, ios, gettext, html, javaProperties, yaml, xliff, xml, json, docx, pptx, xlsx, idml, qt, resx, plaintext, cvs, stringsdict.

array $params: (optional) An associative array of additional options, with the following elements:

  • 'approved': Determines whether content in the file is authorized (available for translation) upon submitting the file via the Smartling Dashboard.
  • 'localesToApprove': This value, if set, authorizes strings for translation into specific locales.

Return value

array Data about uploaded file.

Throws

\Drupal\tmgmt_smartling\Smartling\SmartlingApiException

See also

http://docs.smartling.com/pages/API/FileAPI/Upload-File/

File

src/Smartling/SmartlingApi.php, line 202

Class

SmartlingApi

Namespace

Drupal\tmgmt_smartling\Smartling

Code

public function uploadFile($realPath, $file_name, $file_type, $params = array()) {
  $params['file'] = $realPath;
  $params['fileUri'] = $file_name;
  $params['fileType'] = $file_type;
  return $this
    ->sendRequest('file/upload', $params, 'POST');
}