public function testGetExtensionUndefined() { $this->assertEquals(null, $this->mime->getExtension('undefined')); }
public static function detectFileExtension(UploadedFile $file) { if ($file->getClientOriginalExtension()) { return $file->getClientOriginalExtension(); } $mimeTypes = new MimeTypes(); $extension = $mimeTypes->getExtension(mime_content_type($file->getRealPath())); if ($extension) { if ($extension == 'jpeg') { return 'jpg'; } return $extension; } return 'txt'; }