Creates the handler and writes the files.
@param $file string | The filename.
@return string
181469
private function write_to($file, $data)
  {
    $handler = fopen($file, "w");
    fwrite($handler, $data);
    fclose($handler);
  }
26667
public function handleFileUpload($file)
    {
        // Trigger before save hook
        $this->triggerBeforeSaveHook($file);

        $filePath = $this->getFileUploadPath($file);

        $this->getStorageDisk()->put($filePath, file_get_contents($file), 'public');

        // Trigger after save hook
        $this->triggerAfterSaveHook($file);

        return $filePath;
    }
709440
protected function createFromUrl($file)
	{
		$ch = curl_init ($file);
		curl_setopt($ch, CURLOPT_HEADER, 0);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$rawFile = curl_exec($ch);
		curl_close ($ch);

		// Get the original name of the file
		$ori_name = pathinfo($file);
		$name = $ori_name['basename'];
		
		// Create a filepath for the file by storing it on disk.
		$filePath = sys_get_temp_dir() . "/$name";
		file_put_contents($filePath, $rawFile);

		return new File($filePath);
	}
570876
public static function file( $file )
	{
		$params = array_merge( static::$params, array(
			'time' => time(),
			'fingerprint' => \CCSession::fingerprint(),
			'random' => CCStr::random(),
		));
		
		foreach( $params as $param => $value )
		{
			$file = str_replace( ':'.$param, $value, $file );
		}
		
		return $file;
	}
424962
public function create($file = '')
    {
        $this->file   = $file;
        $this->memory = '';
        $this->fh     = 0;

        if ($this->file) {
            // determine compression
            if ($this->comptype == Archive::COMPRESS_AUTO) {
                $this->setCompression($this->complevel, $this->filetype($file));
            }

            if ($this->comptype === Archive::COMPRESS_GZIP) {
                $this->fh = @gzopen($this->file, 'wb'.$this->complevel);
            } elseif ($this->comptype === Archive::COMPRESS_BZIP) {
                $this->fh = @bzopen($this->file, 'w');
            } else {
                $this->fh = @fopen($this->file, 'wb');
            }

            if (!$this->fh) {
                throw new ArchiveIOException('Could not open file for writing: '.$this->file);
            }
        }
        $this->writeaccess = true;
        $this->closed      = false;
    }
757240
public function save($file = null)
    {
        //argument 1 must be a file or null
        Argument::i()->test(1, 'string', 'null');
        
        if (is_null($file)) {
            $file = $this->file;
        }
        
        if (is_null($file)) {
            Exception::i()
                ->setMessage(Argument::INVALID_ARGUMENT)
                ->addVariable(1)
                ->addVariable(__CLASS__.'->'.__FUNCTION__)
                ->addVariable('file or null')
                ->addVariable($file)
                ->setTypeLogic()
                ->trigger();
        }
        
        File::i($file)->setData($this->language);
        
        return $this;
    }
902468
public static function make(string $file) : Route
  {
    $router = new Route;
    $router->file = $file;

    return $router;
  }
503347
private function createWriter($file = null)
    {
        if ($file || $this->_useTemporaryFile) {
            if (!($this->_writer instanceof PHPRtfLite_StreamOutput)) {
                $this->_writer = new PHPRtfLite_StreamOutput();
            }
            if (is_null($file)) {
                $file = sys_get_temp_dir() . '/' . md5(microtime(true)) . '.rtf';
            }
            $this->_writer->setFilename($file);
        }
        else if (!($this->_writer instanceof PHPRtfLite_Writer_String)) {
            $this->_writer = new PHPRtfLite_Writer_String();
        }
    }
1339427
protected function constructString($file) {
    if (mb_strlen($file) == 0)
      throw new Exception('keine Datei angegeben');
    
    $dir = NULL;
    try {
      $dir = Dir::extract($file);
    } catch (Exception $e) {
      /* kein Verzeichnis vorhanden, vll ein Notice? (aber eigentlich sollte dies ja auch okay sein */
    }
    
    $filename = self::extractFilename($file);

    $this->constructDefault($filename,$dir);
  }
381922
private function compile($file)
    {
        $this->dispatchEvent('before.compile', $file);

        $compiled = $this->getCompiler()->compile(file_get_contents($file));

        $this->dispatchEvent('after.compile', $file);

        return $compiled;
    }
1321213
public function sendFile($file) {
		if ($this->sent) {
			return $this;
		}

		$this->setMode(self::MODE_FILE);
		$this->send($file);

		return $this;
	}
706170
protected function createUploadedFile($file)
	{
		try {
			$imageManager = new ImageManager;
			$image = $imageManager->make($file);
			$extension = $this->getExtensionFromMime($image->mime());
			$fileName = $this->generateFileName($extension);
			$temporaryPath = $this->getTemporaryImageBasePath();
			$this->temporaryImage = $temporaryPath.'/'.$fileName;
			$image->save($this->temporaryImage);

			return new UploadedFile(
				$this->temporaryImage,
				$fileName, 
				$image->mime(),
				$image->filesize(),
				null,
				TRUE
			);
		} catch (Exception $e) {
			throw new ImageUploaderException("Error create uploaded file");
		}
	}
502924
protected function generateCacheFile($file)
    {
        $cacheSalt = serialize(array(
            $this->request->options,
            MUNEE_USING_URL_REWRITE,
            MUNEE_DISPATCHER_FILE
        ));
        $params = serialize($this->request->params);
        $ext = pathinfo($file, PATHINFO_EXTENSION);

        $fileHash = md5($file);
        $optionsHash = md5($params . $cacheSalt);

        $cacheDir = $this->cacheDir . DS . substr($fileHash, 0, 2);

        Utils::createDir($cacheDir);

        return $cacheDir . DS . substr($fileHash, 2) . '-' . $optionsHash . '.' . $ext;
    }
692037
public function setOutputFile($file)
    {
        $dir = dirname($file);
        if (is_file($file)) {
            throw new \InvalidArgumentException('File exists: '.$file, ErrorCodes::FILE_EXISTS);
        }
        if (!is_dir($dir)) {
            throw new \InvalidArgumentException('Directory not exists: '.$dir, ErrorCodes::DIR_NOT_FOUND);
        }
        if (!is_writable($dir)) {
            throw new \InvalidArgumentException('Directory not writeable: '.$dir, ErrorCodes::DIR_NOT_WRITEABLE);
        }
        $this->outputFile = $file;
        return $this;
    }
785102
public function createFileName($file)
    {
        if ( ! is_null($this->elfinderFilePath) ) {
            return $this->getFileName();
        }
        if ( is_string($file) ) {
            return substr( strrchr( $file, '/' ), 1 );
        }

        $filename = $file->getClientOriginalName();
        $mime = $file->getClientOriginalExtension();
        $parts = explode('.',$filename);
        array_pop($parts);
        return str_slug( implode(' ', $parts), '-' ) . '_' . time() .  '.' . $mime;
    }
921272
private function writeGetState( $file, $fields )
    {
        fwrite( $file, "    /**\n" );
        fwrite( $file, "     * Get the PersistentObject state.\n" );
        fwrite( $file, "     *\n" );
        fwrite( $file, "     * @return array(string=>mixed) The state of the object.\n" );
        fwrite( $file, "     */\n" );
        fwrite( $file, "     public function getState()\n" );
        fwrite( $file, "     {\n" );
        fwrite( $file, "         return array(\n" );
        foreach ( $fields as $fieldName => $field )
        {
            fwrite( $file, "             '$fieldName' => \$this->$fieldName,\n" );
        }
        fwrite( $file, "         );\n" );
        fwrite( $file, "     }\n" );
    }
1265550
public function processFile( $file ) {

		$dateDir	= date( 'Y-m-d' );
		$fileName	= $file->name;
		$fileExt	= $file->extension;
		$fileDir	= $file->directory;

		$uploadDir	= $this->uploadDir;

		$sourceFile	= "$fileDir/$fileName.$fileExt";
		$targetDir	= "$dateDir/$fileDir/";

		$filePath = $targetDir . "$fileName.$fileExt";

		// Update File Size in MB
		$fileContent	= file_get_contents( "$uploadDir/temp/$sourceFile" );
		$file->size		= number_format( strlen( $fileContent ) / 1048576, 8 );

		$this->saveFile( $sourceFile, $targetDir, $filePath );

		// Update URL and Thumb
		$file->url = $filePath;
	}