<p dir="auto">This looks like a duplicate of a previously fixed issue (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1115213" data-permission-text="Title is private" data-url="https://github.com/symfony/symfony/issues/1441" data-hovercard-type="issue" data-hovercard-url="/symfony/symfony/issues/1441/hovercard" href="https://github.com/symfony/symfony/issues/1441">#1441</a>) which is occurring for me in 2.1.x-dev beta version (just upgraded to beta 4 today).<br>
In my php.ini upload_max_filesize is set to 2M<br>
When I upload a file &gt; 2M (3.2M in my case) I get<br>
<code class="notranslate">The file "" does not exist 500 Internal Server Error - FileNotFoundException</code><br>
When I upload any file &lt; 2M I have no issue.  I also tried changing my file maxSize assertion to be less than 2M, but that had no effect.</p>
<p dir="auto">I'll paste the stack trace below.  It comes up from my usage of getMimeType() on the file in my preUpload callback</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    /**    
     * @ORM\PrePersist()
     * @ORM\PreUpdate()
     */
    public function preUpload()
    {
        if (null !== $this-&gt;file)
        {
            // do whatever you want to generate a unique name
            $this-&gt;path = uniqid() . '.' . $this-&gt;file-&gt;guessExtension();

            $this-&gt;mimeType = $this-&gt;file-&gt;getMimeType();
        }
        $this-&gt;setUpdateTime(time());
    }"><pre class="notranslate"><code class="notranslate">    /**    
     * @ORM\PrePersist()
     * @ORM\PreUpdate()
     */
    public function preUpload()
    {
        if (null !== $this-&gt;file)
        {
            // do whatever you want to generate a unique name
            $this-&gt;path = uniqid() . '.' . $this-&gt;file-&gt;guessExtension();

            $this-&gt;mimeType = $this-&gt;file-&gt;getMimeType();
        }
        $this-&gt;setUpdateTime(time());
    }
</code></pre></div>
<p dir="auto">Here is the stack trace:<br>
<code class="notranslate">Stack Trace 1.  in /data/www/bfg_v2/Symfony/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php at line 107   2.  at MimeTypeGuesser -&gt;guess ('')  in /data/www/bfg_v2/Symfony/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/File.php at line 79   3.  at File -&gt;getMimeType ()  in /data/www/bfg_v2/Symfony/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/File.php at line 58   4.  at File -&gt;guessExtension ()  in /data/www/bfg_v2/Symfony/src/CG5/BFG/CoreBundle/Entity/Document.php at line 74   5.  at Document -&gt;preUpload ()  in kernel.root_dir/cache/dev/doctrine/orm/Proxies/__CG__CG5BFGCoreBundleEntityDocument.php at line 60   6.  at Document -&gt;preUpload ()  in /data/www/bfg_v2/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php at line 1884   7.  at ClassMetadataInfo -&gt;invokeLifecycleCallbacks ('preUpdate', object(Document))  in /data/www/bfg_v2/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php at line 947   8.  at UnitOfWork -&gt;executeUpdates (object(ClassMetadata))  in /data/www/bfg_v2/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php at line 310   9.  at UnitOfWork -&gt;commit (null)  in /data/www/bfg_v2/Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php at line 355   10. at EntityManager -&gt;flush ()  in /data/www/bfg_v2/Symfony/src/CG5/BFG/CoreBundle/Controller/ClassifiedController.php at line 231   11. at ClassifiedController -&gt;updateAction ('10') 12. at ReflectionMethod -&gt;invokeArgs (object(ClassifiedController), array('10'))  in /data/www/bfg_v2/Symfony/vendor/jms/cg/src/CG/Proxy/MethodInvocation.php at line 63   13. at MethodInvocation -&gt;proceed ()  in /data/www/bfg_v2/Symfony/vendor/jms/security-extra-bundle/JMS/SecurityExtraBundle/Security/Authorization/Interception/MethodSecurityInterceptor.php at line 122   14. at MethodSecurityInterceptor -&gt;intercept (object(MethodInvocation))  in /data/www/bfg_v2/Symfony/vendor/jms/cg/src/CG/Proxy/MethodInvocation.php at line 58   15. at MethodInvocation -&gt;proceed ()  in kernel.root_dir/cache/dev/diextra/proxies/CG5-BFG-CoreBundle-Controller-ClassifiedController.php at line 21   16. at ClassifiedController -&gt;updateAction ('10') 17. at call_user_func_array (array(object(ClassifiedController), 'updateAction'), array('10'))  in kernel.root_dir/bootstrap.php.cache at line 1419   18. at HttpKernel -&gt;handleRaw (object(Request), '1')  in kernel.root_dir/bootstrap.php.cache at line 1383   19. at HttpKernel -&gt;handle (object(Request), '1', true)  in kernel.root_dir/bootstrap.php.cache at line 1559   20. at HttpKernel -&gt;handle (object(Request), '1', true)  in kernel.root_dir/bootstrap.php.cache at line 610  21. at Kernel -&gt;handle (object(Request))  in /data/www/bfg_v2/Symfony/web/app_dev.php at line 28</code></p>
<p dir="auto">hinclude() allows dynamic retrieval of a controller's response. What if I want to use the result of this variable multiple times in my twig template?</p>
<p dir="auto"><strong>Option 1</strong></p>
<p dir="auto">Make multiple calls for the same string:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;div&gt;{{ render_hinclude(controller('AppBundle:App:getString'), {'default': 'Loading'}) }}&lt;/div&gt;
Some more data....
&lt;div&gt;{{ render_hinclude(controller('AppBundle:App:getString'), {'default': 'Loading'}) }}&lt;/div&gt;"><pre class="notranslate"><code class="notranslate">&lt;div&gt;{{ render_hinclude(controller('AppBundle:App:getString'), {'default': 'Loading'}) }}&lt;/div&gt;
Some more data....
&lt;div&gt;{{ render_hinclude(controller('AppBundle:App:getString'), {'default': 'Loading'}) }}&lt;/div&gt;
</code></pre></div>
<p dir="auto">Result: duplicated code.</p>
<p dir="auto"><strong>Option 2</strong></p>
<p dir="auto">Place the result of this in a variable, and use this variable in multiple places. <strong>Doesn't actually work</strong>...</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{% set var = {{ render_hinclude(controller('AppBundle:App:getString')) }} %}
&lt;div&gt;{{ var|raw }}&lt;/div&gt;
Some more data...
&lt;div&gt;{{ var|raw }}&lt;/div&gt;"><pre class="notranslate"><code class="notranslate">{% set var = {{ render_hinclude(controller('AppBundle:App:getString')) }} %}
&lt;div&gt;{{ var|raw }}&lt;/div&gt;
Some more data...
&lt;div&gt;{{ var|raw }}&lt;/div&gt;
</code></pre></div>
<p dir="auto">Obviously the above doesn't work because the {{ var }} variables are being looked for on-page-load.</p>