fuel / core

Fuel PHP Framework - The core of the Fuel v1 framework
http://fuelphp.com
813 stars 345 forks source link

Missing message in Upload error for duplicated file #894

Closed billmn closed 12 years ago

billmn commented 12 years ago

I've set Upload configuration to doesn't "auto_rename" and "overwrite" files.

When I upload a file tthat already exists I found the error in Upload::get_errors() array, but missing the "message" key (I've checked and 110 is the right error code)

array(1) {
  [0]=>
  array(11) {
    ["name"]=>
    string(9) "grain.gif"
    ["type"]=>
    string(9) "image/gif"
    ["error"]=>
    bool(true)
    ["size"]=>
    int(4982)
    ["field"]=>
    string(11) "file_upload"
    ["key"]=>
    bool(false)
    ["file"]=>
    string(36) "/Applications/MAMP/tmp/php/phpwZuBW7"
    ["errors"]=>
    array(1) {
      [0]=>
      array(1) {
        ["error"]=>
        int(110)
      }
    }
    ["extension"]=>
    string(3) "gif"
    ["filename"]=>
    string(5) "grain"
    ["mimetype"]=>
    string(9) "image/gif"
  }
}
WanWizard commented 12 years ago

All messages are added after processing using the upload language file.

Does this exist and is it up to date (i.e. does it contain a string for UPLOAD_ERR_DUPLICATE_FILE)?

billmn commented 12 years ago

Yes and all other messages works fine ... and yes, I have \Upload::UPLOAD_ERR_DUPLICATE_FILE in lang file

WanWizard commented 12 years ago

I can not reproduce it:

'errors' => 
  array
    0 => 
      array
        'error' => int 110
        'message' => string 'A file with the name of the uploaded file already exists' (length=56)

This suggests there must be an issue with your language file. Maybe one exists in app (or elsewhere, like in a module) that doesn't have this?

WanWizard commented 12 years ago

@billmn any feedback?

billmn commented 12 years ago

No ... there aren't any "upload.php" language file in other folders. I don't know why but I have the same problem with another project in FuelPHP (that use the last version of CORE, ..)

I think that I can test upload in another new project with clean FuelPHP files this evening and update this issue soon

WanWizard commented 12 years ago

Ok. I'm very interested to see what happens, as I can't reproduce it here.

billmn commented 12 years ago

Ok ... I have the same error on a fresh install.

I've created a repo for you : https://github.com/billmn/fuel-upload-test I know, the code is horrible, but is only a test :)

WanWizard commented 12 years ago

Thanks for taking the time, this made finding it a breeze!