Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Upload class changes in v1.6
  • It looks like you guys should update docs for this class :)
    I just found that there is no need to run  Upload::process(); manually anymore.
    Also, when I used closure to handle 'before' event I got an error:

    Fuel\Core\PhpErrorException [ Warning ]: Parameter 1 to Admin\{closure}() expected to be a reference, value given



    fuel/vendor/fuelphp/upload/src/FuelPHP/Upload/File.php
    @ line 502

    so I've changed line 502 from:

    $result = call_user_func($callback, $this);

    to:

    $result = call_user_func_array($callback, array(&$this));

    and in the end, in my 'before' event handler, I had to change $file['saved_to'] to $file['path'] 'cos there was an error about missing 'saved_to' attribute.

    I hope all this will help you to improve your really cool framework.

    P.s. Fuel runs on php 5.3.25
  • HarroHarro
    Accepted Answer
    Calling process() was never required.

    The configuration has an 'auto_process' setting, which is true by default, and will call process() for you. You only need to call process() manually if you want to pass a custom config at runtime, in which case you need to set 'auto_process' to false.

    With the old (pre 1.6) code this was not an issue due to a bug in the code, but the new 2.0 upload library will do exactly as you ask, and process the files twice.

    As to your warning: I've committed the fix to the develop branch.

    For the most part, the 1.x Upload facade has been created to be API compatible with the pre-1.6 class. The exception to this are callbacks, which now receive the 2.0 File object instead of the 1.x array, and as you have noticed, the properties aren't 100% compatible.
  • Great, thank you guys!

Howdy, Stranger!

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

In this Discussion