FTP_ZIP_X.php

ftp hosting gratisan lambat banget, sedangkan jika upload zip, ketika diekstrak gagal terus kalo pake file manager bawaan.

mau tidak mau, aku harus turun tangan.

<?php
/**
*
* WARNING: DATA LOSS; (YOU HAVE BEEN WARNED)
*
* @version 20160124071141
* @version 20201023144831
* @author anovsiradj
* @author Touqeer Shafi
* @link https://superuser.com/a/1030589
*
* create zip inside target directory (ex: /somedir/ => /somedir/somedir.zip)
* upload zip (ex: /public_html/somedir.zip)
* run this script from http(s).
* the result should be /public_html/somedir/
* delete zip (ex: /public_html/somedir.zip)
*
*/
$regex = '/\.zip$/';
$file = scandir(__DIR__);
$file = array_filter($file, fn($i) => preg_match($regex, $i) == 1);
$file = current($file);
if (empty($file)) die('No ZIP');
$path_zip = __DIR__ . "/${file}";
$path_dir = preg_replace($regex, '', $file);
$path_dir = __DIR__ . "/${path_dir}";
$zip = new ZipArchive;
if ($zip->open($path_zip)) {
$zip->extractTo($path_dir);
$zip->close();
}
view raw FTP_ZIP_X.php hosted with ❤ by GitHub

Komentar

Postingan populer dari blog ini

cara susah pasang Android Studio di Windows

windows 11 remove usb write-protected