private function _uploadFile($file, $folderId)
{
$fileName = AssetsHelper::cleanAssetName($file['name']);
// Save the file to a temp location and pass this on to the source type implementation
$filePath = AssetsHelper::getTempFilePath(IOHelper::getExtension($fileName));
move_uploaded_file($file['tmp_name'], $filePath);
$response = craft()->assets->insertFileByLocalPath($filePath, $fileName, $folderId);
// Make sure the file is removed.
IOHelper::deleteFile($filePath, true);
// Prevent sensitive information leak. Just in case.
$response->deleteDataItem('filePath');
// Return file ID
return $response->getDataItem('fileId');
}