Chan eil agad ach a dhèanamh gus faidhle a luchdachadh sìos chun t-seirbheisiche agad le bhith a’ leantainn nam fuasglaidhean gu h-ìosal.
Fuasgladh 1
Bho PHP 5.1.0, file_put_contents()
a’ toirt taic do sgrìobhadh pìos-air-pìos le bhith a’ dol seachad air làmh-sruth mar an $data
paramadair:
file_put_contents("Tmpfile.zip", fopen("http://someurl/file.zip", 'r'));
Fuasgladh 2
private function downloadFile($url, $path)
{
$newfname = $path;
$file = fopen ($url, 'rb');
if ($file) {
$newf = fopen ($newfname, 'wb');
if ($newf) {
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8), 1024 * 8);
}
}
}
if ($file) {
fclose($file);
}
if ($newf) {
fclose($newf);
}
}