help converting php code to c#?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
hello all
i don't know if this is the right place to put this but i need to
convert the following code to c# -
any help will be useful
thnx in advance

//the web path of the image you want to get
$source_file = " ";

//the absolute file path you are writing to
$destination_file = "/rootfolder/site/safeDirectory/pic0.jpg";

//read the source file into buffer
$filecontents = ob_get_contents();

//move its contents
//this overwrites the destination file!
if($fp = fopen($destination_file,'w+')) {

Re: help converting php code to c#? wrote:

Quoted text here. Click to load it

Might be best to post this to a C# group and explain what the code does.

I'm not quite sure in your code why you're buffering the output from
readfile because you can either use fopen on the URL or you can simply
do it with one line of code like so:

$filecontents = file_get_contents($source_file);

This will work whether it's a local file or a URL. (And from PHP5
there's also the nice file_put_contents() function as well so you can
write a file with one line of code).

Chris Hope - The Electric Toolbox - /

Site Timeline