0

I was writing code for YIi, fileuploading.

When I write this:

$model->album_photocover = CUploadedFile::getInstance($model, 'album_photocover');

$model->album_photocover->saveAs($path . '/' . $model->album_photocover);

it works.

     CUploadedFile::getInstance($model, 'album_photocover')->saveAs($path . '/' . $model->album_photocover);

But not the below one. Its only same code but written in one line. I hope you got it simply.

Aaron W.
  • 9,254
  • 2
  • 34
  • 45
khunshan
  • 2,662
  • 4
  • 28
  • 34
  • Any errors? A log file? – JorgeeFG Aug 20 '13 at 16:06
  • 1
    I suspect the two of first line of codes that you said it worked. How could the $model->album_photocover that you set into object be appended such a string on second line? May I be missing something? – Telvin Nguyen Aug 20 '13 at 16:37

1 Answers1

0

In your "one-line-solution", when you valorize $model->album_photocover that you use to compose the save path?

CUploadedFile::getInstance($model, 'album_photocover')
       ->saveAs($path . '/' . $model->album_photocover);
//____________________________^++++++++++++++++++++++^

ADD I seen now @Telvin Nguyen comment, yep, that's the problem!

Ivan Buttinoni
  • 4,110
  • 1
  • 24
  • 44