Upload::register('before', function (&$file) use ($article) { var_dump($file); $file['saved_to'] .= $article->thumbnail; $file['saved_as'] = $article->id; $file['name'] = $article->id; var_dump($file); var_dump($article->thumbnail); }); Upload::process(); Upload::save();
var_dump($file); (before closure is finished) array 'name' => string 'signature.jpg' (length=13) 'type' => string 'image/jpeg' (length=10) 'error' => int 0 'size' => int 12631 'field' => string 'thumbnail' (length=9) 'key' => boolean false 'file' => string '/private/var/tmp/phpTr2Lri' (length=26) 'extension' => string 'jpg' (length=3) 'filename' => string 'signature' (length=9) 'mimetype' => string 'image/jpeg' (length=10) 'message' => string 'The file uploaded with success' (length=30) 'saved_to' => string '/Volumes/Storage/Projects/soanime/public/assets/img/articles/' (length=61) 'saved_as' => string 'signature.jpg' (length=13) var_dump($file); (after closure is finished) array 'name' => string '1' (length=1) 'type' => string 'image/jpeg' (length=10) 'error' => int 0 'size' => int 12631 'field' => string 'thumbnail' (length=9) 'key' => boolean false 'file' => string '/private/var/tmp/phpTr2Lri' (length=26) 'extension' => string 'jpg' (length=3) 'filename' => string 'signature' (length=9) 'mimetype' => string 'image/jpeg' (length=10) 'message' => string 'The file uploaded with success' (length=30) 'saved_to' => string '/Volumes/Storage/Projects/soanime/public/assets/img/articles/c/8/' (length=65) 'saved_as' => string '1' (length=1) var_dump($article->thumbnail); string 'c/8/' (length=4)
Harro Verton wrote on Thursday 28th of July 2011:I'm not in a position to test at the moment. I see in the code (line 556) that the array is passed by reference, that doesn't seem right. Could you change that, and see if that is the culprit?
It looks like you're new here. If you want to get involved, click one of these buttons!