exists() public method

Indicates whether the file exists in the filesystem.
public exists ( ) : boolean
return boolean
 public function testCreateAnDeleteFile()
 {
     $fs = $this->getFilesystem();
     $filename = uniqid('test_');
     $file = new File($filename, $fs);
     $this->assertFalse($file->exists());
     $file->setContent('Hello');
     $this->assertTrue($file->exists());
     $file->delete();
     $this->assertFalse($file->exists());
 }
 /**
  * Return the upload status.
  *
  * @param  \SRIO\RestUploadBundle\Upload\UploadContext $context
  * @param  ResumableUploadSession                      $uploadSession
  * @param  \Gaufrette\File                             $file
  * @param  array                                       $range
  * @return UploadResult
  */
 protected function requestUploadStatus(UploadContext $context, ResumableUploadSession $uploadSession, File $file, array $range)
 {
     if (!$file->exists()) {
         $length = 0;
     } else {
         $length = $file->getSize();
     }
     $response = new Response(null, $length == $range['total'] ? 201 : 308);
     if ($length < 1) {
         $length = 1;
     }
     $response->headers->set('Range', '0-' . ($length - 1));
     $result = new UploadResult();
     $result->setResponse($response);
     return $result;
 }