Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/08/2016, 08:44
weltxo
 
Fecha de Ingreso: abril-2013
Mensajes: 75
Antigüedad: 12 años
Puntos: 2
The file "" does not exist 500 Internal Server Error - FileNotFoundException

Hola amigos, he buscado este problema por internet pero no consigo entender por qué.
Cuando realizo subidas de archivos, la aplicación casca a partir del tamaño del archivo de subida.

Tengo la siguiente entidad, la cual deseo persistir en base de datos:

Código:
<?php

namespace FileBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;

/**
 * Description of File
 * 
 * @ORM\Entity
 * @ORM\Table(name="archivo")
 * @Vich\Uploadable
 */
class File
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
    
    /**
     * @ORM\Column(type="string", nullable=FALSE)
     *
     * @var string
     */
    protected $name;
    
    /**
     * @ORM\Column(type="string", nullable=FALSE)
     * 
     * @var string
     */
    protected $mimeType;
    
    /**
     * @ORM\Column(type="string", nullable=TRUE)
     * 
     * @var string
     */
    protected $extension;
    
    /**
     * @ORM\Column(type="integer", nullable=TRUE)
     * 
     * @var integer
     */
    protected $size;
    
    /**
     * @ORM\Column(type="string", nullable=FALSE)
     * 
     * @var string
     */
    protected $path;
    
    /**
     * @ORM\ManyToOne(targetEntity="UserBundle\Entity\User")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     * 
     * @var UserBundle\Entity\User
     */
    protected $user;
    
     /**
      * @ORM\Column(type="datetime", nullable=FALSE)
      * 
      * @var \DateTime
      */
    protected $uploadedAt;
    
    /**
     * @ORM\Column(type="datetime", nullable=FALSE)
     * 
     * @var \DateTime
     */
    protected $updatedAt;
    
    /**
     * NOTE: This is not a mapped field of entity metadata, just a simple property.
     * 
     * @Vich\UploadableField(mapping="upload_file", fileNameProperty="name")
     * 
     * @var \Symfony\Component\HttpFoundation\File\File
     */
    protected $file;
    
    
    public function getId() {
        return $this->id;
    }

    /**
     * @return \Symfony\Component\HttpFoundation\File\File
     */
    public function getFile() {
        return $this->file;
    }

    /**
     * @return string
     */
    public function getName() {
        return $this->name;
    }

    /**
     * @return string
     */
    public function getMimeType() {
        return $this->mimeType;
    }
    
    /**
     * @return string
     */
    public function getExtension() {
        return $this->extension;
    }
    
    /**
     * @return integer
     */
    public function getSize() {
        return $this->size;
    }

    /**
     * @return \DateTime
     */
    public function getUploadedAt() {
        return $this->uploadedAt;
    }
    
    /**
     * @return \DateTime
     */
    public function getUpdatedAt() {
        return $this->updatedAt;
    }
    
    /**
     * @return string
     */
    public function getPath() {
        return $this->path;
    }
    
    /**
     * @return \UserBundle\Entity\User
     */
    public function getUser() {
        return $this->user;
    }

    /**
     * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
     * of 'UploadedFile' is injected into this setter to trigger the  update. If this
     * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
     * must be able to accept an instance of 'File' as the bundle will inject one here
     * during Doctrine hydration.
     *
     * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $file
     *
     * @return \FileBundle\Entity\File
     */
    public function setFile(\Symfony\Component\HttpFoundation\File\File $file = null) {
        $this->file = $file;

        if ($file) {
            // It is required that at least one field changes if you are using doctrine
            // otherwise the event listeners won't be called and the file is lost
            $this->updatedAt = new \DateTime('now');
            $this->uploadedAt = new \DateTime('now');
            $this->extension = $file->getExtension();
            $this->mimeType = $file->getMimeType();
            $this->path = $file->getPath();
            $this->size = $file->getSize();
        }

        return $this;
    }

    /**
     * @param string $name
     */
    public function setName($name) {
        $this->name = $name;
    }

    /**
     * @param string $mimeType
     */
    public function setMimeType($mimeType) {
        $this->mimeType = $mimeType;
    }
    
    /**
     * @param string $extension
     */
    public function setExtension($extension) {
        $this->extension = $extension;
    }
    
    /**
     * @param integer $size
     */
    public function setSize($size) {
        $this->size = $size;
    }

    /**
     * @param \DateTime $uploadedAt
     */
    public function setUploadedAt(\DateTime $uploadedAt = null) {
        $this->uploadedAt = $uploadedAt;
    }
    
    /**
     * @param \DateTime $updatedAt
     */
    public function setUpdatedAt(\DateTime $updatedAt = null) {
        $this->updatedAt = $updatedAt;
    }
    
    /**
     * @param string $path
     */
    public function setPath($path) {
        $this->path = $path;
    }

    /**
     * @param \UserBundle\Entity\User $user
     */
    public function setUser(\UserBundle\Entity\User $user = null) {
        $this->user = $user;
    }
}
Como pueden ver es una entidad muy sencilla, almaceno el tamaño, path, mimetype y el usuario de la subida.
El problema es que cuando los archivos de subida pesan a partir de 1MB se produce error:

Código:
The file "" does not exist
500 Internal Server Error - FileNotFoundException
Mi archivo php.ini:

Código:
post_max_size = 32M
upload_max_filesize = 32M
No entiendo por qué ocurre esto. Si alguien tuvo este problema, comenten, gracias por adelantado.