Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Upload::Process not throwing Exception
  • I am getting the following error from Upload::


    ERROR - 2014-03-13 18:19:16 --> Error - No uploaded files were found. Did you specify "enctype" in your <form> tag? in /Users/mikep/Sites/local.dermasensa.com/fuel/vendor/fuelphp/upload/src/Fuel/Upload/Upload.php on line 94


    I know what the problem is, I simply want to catch it.


    [Thu Mar 13 18:17:09.646742 2014] [:error] [pid 958:tid 4481605632] [client 127.0.0.1:61701] PHP Warning:  POST Content-Length of 18126422 bytes exceeds the limit of 8388608 bytes in Unknown on line 0, referer: http://local.dermasensa.com/en/admin/documents/create


    However I was expecting Upload::process to throw a FuelException

  • It throws a \Fuel\Upload\NoFilesException exception.

    I don't see any encapsulation in the v1 facade class, so you should be able to catch it.
  • I was using:

            // process the uploaded files in $_FILES
            try{
                Upload::process($config);
            } catch (Exception $e){
                $this->exit_status($e->getMessage(), -1);
                exit();
            }

    And it never got thrown.  It is in a REST controller (not that it should make a difference).
  • Is that controller in a namespace?

    If so you need to catch \Exception, otherwise PHP tries to catch a class called "Exception" in the current namespace, which is never thrown.
  • It is not...  but for the fun of it I will give it a try tonight or tomorrow and see if it makes a difference.

    <?php

    class Controller_Admin_DocumentRest extends Controller_AdminRest {


  • Just noticed you capture the process() call.

    The check happens in the constructor, so depending on your config (auto_process comes to mind) the class might be instantiated somewhere else, before you get to this bit of code.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion