update page now

Voting

: zero plus zero?
(Example: nine)

The Note You're Voting On

flobee
19 years ago
download: i need a function to simulate a "wget url" and do not buffer the data in the memory to avoid thouse problems on large files:
<?php
function download($file_source, $file_target) {
 $rh = fopen($file_source, 'rb');
 $wh = fopen($file_target, 'wb');
 if ($rh===false || $wh===false) {
// error reading or opening file
 return true;
 }
 while (!feof($rh)) {
 if (fwrite($wh, fread($rh, 1024)) === FALSE) {
 // 'Download error: Cannot write to file ('.$file_target.')';
 return true;
 }
 }
 fclose($rh);
 fclose($wh);
 // No error
 return false;
 }
?>

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /