Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Upload fajla na server sa web adrese

[es] :: PHP :: PHP za početnike :: Upload fajla na server sa web adrese

[ Pregleda: 1300 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

ilija666

Član broj: 70361
Poruke: 16
178.79.27.*

Sajt: www.last.fm/music/Endless..


Profil

icon Upload fajla na server sa web adrese23.05.2012. u 14:52 - pre 144 meseci
pokusavao sam sa ova dva nacina, ali sve sto dobijam je prazan fajl u folderu na serveru.
folder ima dovoljne dozvole za upis.

function save_image($inPath,$outPath)
Code:
{ //Download images from remote server
    $in=    fopen($inPath, "rb");
    $out=   fopen($outPath, "wb");
    while ($chunk = fread($in,8192))
    {
        fwrite($out, $chunk, 8192);
    }
    fclose($in);
    fclose($out);
}
save_image('http://www.php.net/images/php.gif','image.gif');

i


function download_remote_file($file_url, $save_to)
    {

        $content = file_get_contents($file_url);

        file_put_contents($save_to, $content);
    }

download_remote_file('http://www.php.net/images/php.gif', realpath("./downloads") . '/file.gif');

deWhite
 
Odgovor na temu

[es] :: PHP :: PHP za početnike :: Upload fajla na server sa web adrese

[ Pregleda: 1300 | Odgovora: 0 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.