php - Send a variable's content to a file through FTP -


i create file on ftp server variable's content. possible without writing data file locally first ?

this can do:

$tmpfname = tempnam("/tmp", "foo"); file_put_contents($tmpfname, $file_contents) ftp_put($conn_id, $destination_file, $tmpfname, ftp_binary); unlink($tmpfname); 

but send $file_contents without saving first file.

it's possible using wrappers:

ftp_put($conn_id, $destination_file, 'data://text/plain;base64,' . base64_encode($file_contents), ftp_binary); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -