fuelphp / upload

FuelPHP Framework - File upload library
MIT License
26 stars 16 forks source link

Issue with 2.0.3 #14

Closed it-can closed 9 years ago

it-can commented 9 years ago

Also posted here:

https://github.com/fuel/core/issues/1914

Hi,

I just noticed that when updating to fuelphp/upload 2.0.3 the saved_as name is not set in v2.0.2 it works correct!

Tested in my production enviroment and my development...

This is my example code:

// Custom configuration for this upload
$config = [
    'path'          => IMGPATH,
    'randomize'     => true,
    'ext_whitelist' => ['jpg', 'jpeg', 'gif', 'png'],
    'overwrite'     => true,
    'auto_rename'   => false,
    'field'         => 'avatar',
    'file_chmod'    => 0777,
    'max_size'      => 3000000, // 3mb
];

\Upload::process($config);

// if there are any valid files
if (\Upload::is_valid())
{
    // save them according to the config
    \Upload::save();

    if ($file = \Upload::get_files(0))
    {
       var_dump($file);
    }
}

Output in v2.0.3

Array
(
    [field] => avatar
    [saved_as] => 
    [name] => 11427658_936584796393922_3750488840083698280_n.jpg
    [type] => image/jpeg
    [file] => /tmp/php/phpfxSlP9
    [error] => 
    [size] => 161985
    [extension] => jpg
    [basename] => 11427658_936584796393922_3750488840083698280_n
    [mimetype] => image/jpeg
    [saved_to] => /site/public/assets/img/
    [errors] => Array
        (
        )

)

Output in v2.0.2

Array
(
    [field] => avatar
    [saved_as] => 450c5e37a92863cea046e39f7bd8ae36.jpg
    [name] => 11427658_936584796393922_3750488840083698280_n.jpg
    [type] => image/jpeg
    [file] => /tmp/php/phpznTKtd
    [error] => 
    [size] => 161985
    [extension] => jpg
    [basename] => 11427658_936584796393922_3750488840083698280_n
    [mimetype] => image/jpeg
    [saved_to] => /site/public/assets/img/
    [errors] => Array
        (
        )
)
huglester commented 9 years ago

Hello, please test with 2.0.4, hope it is fixed for you

it-can commented 9 years ago

It seems to work! thanks