Uploads preliminary delivery file to project director

@param
$fileName
Filename that requires translation
@param
$data
File data (String)
@return Response message
428092
function uploadTranslationKit($fileName, $data){
		$result = "";
		$resourceInfo = new ResourceInfo();
		$resourceInfo->name = $fileName;
		$resourceInfo->size = strlen ( $data );
		
		// Upload file
		$workflowRequestTicket = $this->workflowService->upload($resourceInfo, $data)->return;
		
		// Wait until upload is done, or print error message if it failed
		$uploadFinished = false;
		while (!$uploadFinished) {
			// Create delay between two checkUploadAction calls
			sleep(DELAY_TIME);

			$uploadActionResult = $this->workflowService->checkUploadAction($workflowRequestTicket);

			$uploadFinished = $uploadActionResult->processingFinished->booleanValue;
			if ($uploadFinished && isset($uploadActionResult->messages)) {
				foreach($uploadActionResult->messages as &$message){
					$result = $result + $message+";";
				}
			}
		}
		
		return $result;
	}
1075221
public function upload($filename, $destination)
    {
        if (isset($this[$filename])) {
            $file = $this[$filename];
            if (is_uploaded_file($file[static::TMP_NAME])) {
                try {
                    return move_uploaded_file($file[static::TMP_NAME], $destination);
                } catch (\Exception $e) {
                    var_dump($e->getMessage());
                    exit();
                }
            }
        }
        return false;
    }
125311
protected static function saveIni( $fileName, $data )
	{
		$creator	= new FS_File_INI_Creator( TRUE );
		foreach( $data as $sectionName => $sectionData )
		{
			$creator->addSection( $sectionName );
			foreach( $sectionData as $pair )
			{
				switch( $pair['type'] )
				{
					case 'string':
						$pair['value']	= '"'.addslashes( $pair['value'] ).'"';
						break;
					case 'bool':
					case 'boolean':
						$pair['value']	= $pair['value'] ? "yes" : "no";
						break;
				}
				$pair['comment']	= isset( $pair['comment'] ) ? $pair['type'].": ".$pair['comment'] : $pair['type'];
				$creator->addProperty( $pair['key'], $pair['value'], $pair['comment'] );
			}
		}
		return $creator->write( $fileName );
	}
1009119
public function parseFile($filename)
    {
        // Run the fileEval the string, if it throws an exception, rethrow it
        try {
            $data = require $filename;
        } catch (Exception $exception) {
            throw new ParseException(
                [
                    'message'   => 'PHP file threw an exception',
                    'exception' => $exception,
                ]
            );
        }

        // Complete parsing
        return (array)$this->parse($data, $filename);
    }
216832
public function upload(string $projectKey, string $ext, string $filename, array $params)
    {
        if (!file_exists($filename)) {
            throw new Exception\InvalidArgumentException('file '.$filename.' not found');
        }

        if (!isset($params['locale_id'])) {
            throw new Exception\InvalidArgumentException('locale_id is missing in params');
        }

        $postData = [
            ['name' => 'file', 'content' => file_get_contents($filename), 'filename' => basename($filename)],
            ['name' => 'file_format', 'content' => $ext],
            ['name' => 'locale_id', 'content' => $params['locale_id']],
        ];

        if (isset($params['update_translations'])) {
            $postData[] = ['name' => 'update_translations', 'content' => $params['update_translations']];
        }

        if (isset($params['tags'])) {
            $postData[] = ['name' => 'tags', 'content' => $params['tags']];
        }

        $response = $this->httpPostRaw(sprintf('/api/v2/projects/%s/uploads', $projectKey), $postData, [
            'Content-Type' => 'application/x-www-form-urlencoded',
        ]);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Uploaded::class);
    }
1353527
public function excel($filename, $data)
    {
        \Excel::create($filename, function ($excel) use ($filename, $data) {
            $excel->sheet($filename, function ($sheet) use ($data) {
                $sheet->fromArray($data);
            });
        })
              ->export('xlsx');
    }
106251
private function writeFilename($filename, $data)
    {
        $f = fopen($filename, "w+");

        fwrite($f, implode('', $data));
        fclose($f);
    }
573679
protected function publishMigration($filename)
    {
        $extension = '.php';
        $filename = trim($filename, $extension).$extension;
        $stub = __DIR__.'/../migrations/'.$filename;
        $target = $this->getMigrationFilepath($filename);
        $this->publishes([$stub => $target], 'migrations');
    }
344072
public function send($filename, $content)
    {
        $client = $this->getClient();
        $result = new BillResult();

        try {
            $zipContent = $this->compress($filename.'.xml', $content);
            $params = [
                'fileName' => $filename.'.zip',
                'contentFile' => $zipContent,
            ];
            $response = $client->call('sendBill', ['parameters' => $params]);
            $cdrZip = $response->applicationResponse;
            $result
                ->setCdrResponse($this->extractResponse($cdrZip))
                ->setCdrZip($cdrZip)
                ->setSuccess(true);
        } catch (\SoapFault $e) {
            $result->setError($this->getErrorFromFault($e));
        }

        return $result;
    }
1347898
public function attach($filename)
    {
        try {
            $this->mailer->AddAttachment($filename);
        } catch (phpmailerException $e) {
            throw new EmailException($e->getMessage(), $e->getCode());
        }

        return $this;
    }
414256
protected function parse($data = null, $filename = null)
    {
        if (!$data) {
            $error = error_get_last();

            // Parse functions may return NULL but set no error if the string contains no parsable data
            if (!is_array($error)) {
                $error["message"] = "No parsable content in data.";
            }

            $error["file"] = $filename;

            // if string contains no parsable data, no error is set, resulting in any previous error
            // persisting in error_get_last(). in php 7 this can be addressed with error_clear_last()
            if (function_exists("error_clear_last")) {
                error_clear_last();
            }

            throw new ParseException($error);
        }

        return $this->expandDottedKey($data);
    }
61603
public function createFile($fileName)
    {
        foreach ($this->languages() as $languageKey) {
            $file = $this->path."/{$languageKey}/{$fileName}.php";
            if (! $this->disk->exists($file)) {
                file_put_contents($file, "<?php \n\n return[];");
            }
        }
    }
796811
public static function file_put_contents(string $filename, $data, int $flags = 0, $context = null){
		$dir = dirname($filename);
		if(!is_dir($dir)){
			if(!mkdir($dir, 0777, true)){
				throw new Exception("Could not create directory $dir");
			}
		}

		file_put_contents($filename, $data, $flags, $context);
	}
1058215
public function putContents($file_name, $data, $mode = FTP_ASCII)
    {
        if (!is_resource($this->resource)) {
            throw new FtpException("Not connected to FTP server. Call connect() or ssl_connect() first.");
        }
        $temp = tmpfile();
        fwrite($temp, $data);
        fseek($temp, 0);
        return $this->fput($file_name, $temp, $mode);
    }
102329
public static function save( $fileName, $data, $packetName = NULL )
	{
		if( $packetName === NULL )
			$wddx	= wddx_serialize_value( $data );
		else
			$wddx	= wddx_serialize_value( $data, $packetName );
		return FS_File_Writer::save( $fileName, $wddx );
	}
31434
private function parseTemplate($filename, $data)
    {
        if (is_array($data)) {
            $this->_templateData = $data;
        } else if (is_object($data)) {
            if (method_exists($data, 'getTemplateData')) {
                $this->_templateData = $data->getTemplateData();
            } else {
                $this->_templateData = (array)$data;
            }
        } else {
            $this->_templateData = array('variable' => $data);
        }

        $this->allowRecursion = (!empty($this->_templateData['_allowRecursion']) ? true : false);

        $filename = $this->locateViewFile($filename);

        if ($filename) {
            $this->setCurrentTemplate($filename);

            ob_start();
            include $filename;
            $info = ob_get_contents();
            ob_end_clean();

            return $info;
        }

        return false;
    }
571447
public function upload($binaryImage, $filename)
    {
        $filename = $this->randomizeFilename($filename);

        if (!$this->constraints->canUpload()) {
            return $this->constraints->getReason();
        }

        $filepath = $this->localDriver->upload($binaryImage, $filename);

        if ($this->isUnsignedUpload) {
            $response = $this->cloudinaryClient->uploadUnsigned($filepath);
        } else {
            $response = $this->cloudinaryClient->upload($filepath);
        }

        return $this->processResponse($response);
    }