diff --git a/Form/Type/SingleUploadType.php b/Form/Type/SingleUploadType.php
index 76d6ccd..0705da2 100644
--- a/Form/Type/SingleUploadType.php
+++ b/Form/Type/SingleUploadType.php
@@ -2,6 +2,7 @@
namespace Admingenerator\FormExtensionsBundle\Form\Type;
+use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
@@ -16,6 +17,23 @@
*/
class SingleUploadType extends AbstractType
{
+
+ /**
+ * @var ContainerInterface
+ */
+ private $container;
+
+ /**
+ * SingleUploadType constructor.
+ *
+ * @param ContainerInterface $container
+ */
+ public function __construct(ContainerInterface $container)
+ {
+ $this->container = $container;
+ }
+
+
/**
* {@inheritdoc}
*/
@@ -139,7 +157,13 @@ public function getBlockPrefix()
*/
private function _is_file($file)
{
- return $file instanceof File && file_exists($file->getPathName()) && !is_dir($file->getPathName());
+ if ($file instanceof File) {
+ if ($this->container->getParameter('admingenerator.form.image_manipulator') !== null) {
+ return true;
+ }
+ return $this->_fileExists($file);
+ }
+ return false;
}
/**
@@ -148,7 +172,7 @@ private function _is_file($file)
private function _checkFileType($file)
{
// sanity check
- if (!$this->_is_file($file)) return 'inexistent';
+ if (!$this->_fileExists($file)) return 'inexistent';
if ($this->_isAudio($file)) return 'audio';
if ($this->_isArchive($file)) return 'archive';
if ($this->_isHTML($file)) return 'html';
@@ -236,4 +260,14 @@ private function _isVideo(File $file)
{
return (preg_match('/video\/.*/i', $file->getMimeType()));
}
+
+ /**
+ * @param $file
+ *
+ * @return bool
+ */
+ private function _fileExists($file)
+ {
+ return file_exists($file->getPathName()) && !is_dir($file->getPathName());
+ }
}
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 82ab1ee..be4699e 100644
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -103,6 +103,7 @@
+