$realpath
$realpath :
A file in the file system.
guessExtension() : string|null
Returns the extension based on the mime type.
If the mime type is unknown, returns null.
This method uses the mime type as guessed by getMimeType() to guess the file extension.
The guessed extension or null if it cannot be guessed
getMimeType() : string|null
Returns the mime type of the file.
The mime type is guessed using a MimeTypeGuesser instance, which uses finfo(), mime_content_type() and the system binary "file" (in this order), depending on which of those are available.
The guessed mime type (e.g. "application/pdf")
move(string $directory, string $name = null) : self
Moves the file to a new location.
string | $directory | The destination folder |
string | $name | The new file name |
if the target file could not be created
A File object representing the new file
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpFoundation\Tests\File;
use Symfony\Component\HttpFoundation\File\File as OrigFile;
class FakeFile extends OrigFile
{
private $realpath;
public function __construct($realpath, $path)
{
$this->realpath = $realpath;
parent::__construct($path, false);
}
public function isReadable()
{
return true;
}
public function getRealpath()
{
return $this->realpath;
}
public function getSize()
{
return 42;
}
public function getMTime()
{
return time();
}
}