I\'ve got an image upload script which was previously working. It\'s now broken, and I\'ve traced the problem down to one line:
$temp = tmpfile(); // $temp
It might be a problem with permissions. Use sys_get_temp_dir() to see where the temp file will be created and make sure php has access to write there.
sys_get_temp_dir()