CUploadedFile::saveAs not working?

I’m having trouble with the following bit of code:


	


if (mkdir(Yii::app()->basePath.'/../files/'.$filePathArray['directory']))

   {	

      if(false==$file->saveAs(Yii::app()->basePath.'/../files/'.$filePathArray['file_path']))

		{							

		   throw new CException("Couldn't save file");

		}

  }




It’s meant to create a directory and save the file. It works fine on my dev server, but not on the live one. The directory gets created, but the file isn’t saved (saveAs comes back ‘null’.

If I insert a line :




touch Yii::app()->basePath.'/../files/'.$filePathArray['file_path'])



after the mkdir

An empty file is created on the live server, so it doesn’t appear to be permissions.

Also, it’s not file size, as I’m using very small text files to test it

Is there any way I can find out more information about what’s stopping it from saving? Any idea?

I found the problem - no tmp folder set in php config.

Still curious though, is there a way to get error information from SaveAs(), as I had to resort do writing a really basic PHP file save script to find the error?

I think error property may be useful.