[ serbian_boy @ 19.03.2018. 12:30 ] @
Potrebna m je skripta gde cu da ubacim kod sebe u html (nema baze) i kad kliknem na nju da sam zipuje i svuce sve sa hostinga. Da neidem u cpanel pa backup nego jedanklik bukvalno.Hvala |
[ serbian_boy @ 19.03.2018. 12:30 ] @
[ Deunan @ 19.03.2018. 13:32 ] @
Za to ces morati da koristis php.
Kreiraj stranicu download.php (ili neko drugo ime) i dodaj kod: Code: <?php $rootPath = realpath('../public'); // path do root foldera za skidanje $zip = new ZipArchive(); // kreiranje zip-a $zip_file = 'file.zip'; $zip->open($zip_file, ZipArchive::CREATE | ZipArchive::OVERWRITE); $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($rootPath), RecursiveIteratorIterator::LEAVES_ONLY ); foreach ($files as $name => $file) { if (!$file->isDir()) { $filePath = $file->getRealPath(); $relativePath = substr($filePath, strlen($rootPath) + 1); $zip->addFile($filePath, $relativePath); } } $zip->close(); // DOWNLOAD kreiranog zipa header('Content-type: application/zip'); header('Content-Disposition: attachment; filename="'.basename($zip_file).'"'); header("Content-length: " . filesize($zip_file)); header("Pragma: no-cache"); header("Expires: 0"); ob_clean(); flush(); readfile($zip_file); unlink($zip_file); // Obrisi zip da ne zauzima prostor exit; Posle samo otvori tu stranicu 'download.php' Postavi i neku zastitu da ne moze bas svako da pristupi stranici. Obavezno testiraj pre nego postavis na server (sigurno radi, koristio sam davno, al' ipak proveri) [ serbian_boy @ 19.03.2018. 15:44 ] @
Izbacim ovo
Ova stranica ne funkcioniše Host mojsajt.rs trenutno ne može da obradi ovaj zahtev. HTTP ERROR 500 [ serbian_boy @ 19.03.2018. 15:48 ] @
Uspeo,nisam lepo putanju postavio... Ali mi sajt od 3 mb pakuje 2 minuta
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|