When saving as "php://output", we want its content-length. Tmp file should go into sys_get_temp_dir() instead of "./"

Signed-off-by: Julien Carignan <julien.carignan@hotmail.com>