diff --git a/Storage/GaufretteStorage.php b/Storage/GaufretteStorage.php index 7d907033..6eb438bf 100644 --- a/Storage/GaufretteStorage.php +++ b/Storage/GaufretteStorage.php @@ -50,11 +50,11 @@ protected function doUpload(PropertyMapping $mapping, UploadedFile $file, $dir, $filesystem = $this->getFilesystem($mapping); $path = !empty($dir) ? $dir.'/'.$name : $name; + $filesystem->write($path, file_get_contents($file->getPathname()), true); + if ($filesystem->getAdapter() instanceof MetadataSupporter) { $filesystem->getAdapter()->setMetadata($path, ['contentType' => $file->getMimeType()]); } - - $filesystem->write($path, file_get_contents($file->getPathname()), true); } /**