Page 1 of 1
is correct to use file_put_contents ?
Posted: Sun Feb 01, 2009 5:30 am
by aneuryzma
I want to create a file from my raw data, but I don't want to save it to the filesystem. Rather I want to use it in the next function. Could you help me ?
Code: Select all
file_put_contents('filename.ext', $GLOBALS["HTTP_RAW_POST_DATA"]);
$src = $message->attach($img);
Re: is correct to use file_put_contents ?
Posted: Sun Feb 01, 2009 4:00 pm
by infolock
well, the definition of a file is one that is created on the filesystem.
If you don't want to create a file, use
an array
Re: is correct to use file_put_contents ?
Posted: Mon Feb 02, 2009 2:10 am
by aneuryzma
Hi,
how can I solve this:
Code: Select all
file_put_contents('screenshot.jpg', $GLOBALS["HTTP_RAW_POST_DATA"]);
$img =& new Swift_Message_Image(new Swift_File("screenshot.jpg"));
The Swift function wants a file from hard disk, but I would prefer to pass my image without saving it in the filesystem.
thanks
Re: is correct to use file_put_contents ?
Posted: Mon Feb 02, 2009 11:29 am
by infolock
use GD library or store the image contents into a string.