Hi,
I upgraded from 1.5.4 to 1.6 and now I have a problem uploading a file. The file is saving two times.
To trace the error I used the Debug::dump() in the $_FILES and in the Upload::get_files(). Take a look to the result:
My code:
private function create_thumb($id)
{
Debug::dump($_FILES);
$config = array(
'path' => THUMBS,
'normalize' => true,
'ext_whitelist' => array('jpg', 'jpeg'),
'change_case' => 'lower',
);
Upload::process($config);
Debug::dump(Upload::get_files());
die();
if (Upload::is_valid())
{
Upload::save(0);
$file = Upload::get_files(0);
Image::load(THUMBS.$file['saved_as'], false, $file['extension'])
->crop_resize(300, 200)
->save(THUMBS.$file['saved_as']);
$thumb = Model_Video::find($id);
$thumb->set(array(
'thumb' => $file['saved_as'],
));
$thumb->save();
}
if(Upload::get_errors(0))
{
return Upload::get_errors(0);
}
return true;
}
The Result:
FIRST DEBUG
APPPATH/classes/controller/videos.php @ line: 488
Variable #1:
(Array, 1 element) ↵
thumb (Array, 5 elements) ↵
name (String): "04 - SAT detall.jpg" (19 characters)
type (String): "image/jpeg" (10 characters)
tmp_name (String): "/Applications/MAMP/tmp/php/php5iWdzr" (36 characters)
error (Integer): 0
size (Integer): 292614
SECOND DEBUG
APPPATH/classes/controller/videos.php @ line: 499
Variable #1:
(Array, 2 elements) ↵
0 (Array, 11 elements) ↵
field (String): "thumb" (5 characters)
saved_as : null
name (String): "04 - SAT detall.jpg" (19 characters)
type (String): "image/jpeg" (10 characters)
file (String): "/Applications/MAMP/tmp/php/php5iWdzr" (36 characters)
error (Boolean): false
size (Integer): 292614
extension (String): "jpg" (3 characters)
basename (String): "04 - SAT detall" (15 characters)
mimetype (String): "image/jpeg" (10 characters)
errors (Array, 0 elements)
1 (Array, 11 elements) ↵
field (String): "thumb" (5 characters)
saved_as : null
name (String): "04 - SAT detall.jpg" (19 characters)
type (String): "image/jpeg" (10 characters)
file (String): "/Applications/MAMP/tmp/php/php5iWdzr" (36 characters)
error (Boolean): false
size (Integer): 292614
extension (String): "jpg" (3 characters)
basename (String): "04 - SAT detall" (15 characters)
mimetype (String): "image/jpeg" (10 characters)
errors (Array, 0 elements)
It's a bug?
Regards,
It looks like you're new here. If you want to get involved, click one of these buttons!