• 03-04-2025, 01:45:03
    #1
    Selamlar,

    PHP ile kodlamays çalıştım lakin örneğin yükleyici kişinin interneti 10g ise hostingime o kadar hızlı yüklüyor ki dosyayı hosting almıyor vb.
    Sadece indexi olup dosya yükle link ver mantığında çalışan bildiğiniz script var mı?
  • 03-04-2025, 01:46:15
    #2
    İlk yorum benden :Yıl olmuş 2025 millet birbirini 100 TL için dolan*diriyorken sana ücretsiz script mı versinler?
    Lütfen bu ve bu tür yorumlar için girdiyseniz konuya yorum atmadan çıkın
  • 03-04-2025, 01:48:15
    #3
    Üyeliği durduruldu
    işine yararmı bilmem ama bir kaç sitede bu şekilde kullanıyorum bast kendim yazmıştım
    <?php
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Methods: POST, OPTIONS");
    header("Access-Control-Allow-Headers: Content-Type");
    header("Content-Type: application/json");
    $uploadDir = __DIR__ . "ifupload/";
    if (!file_exists($uploadDir)) {
        mkdir($uploadDir, 0777, true);
    }
    $maxFileSize = 100 * 1024 * 1024;
    $allowedExts = [
        "jpg", "jpeg", "png", "gif", "webp", "bmp", "svg",
        "mp4", "mov", "avi", "mkv", "wmv", "flv", "webm",
        "mp3", "wav", "ogg", "flac",
        "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx",
        "zip", "rar", "7z", "tar", "gz"
    ];
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
    $serverAddress = rtrim($protocol . "://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']), "/") . "/ifupload/";
    $response = [
        "success" => false,
        "message" => "",
        "files" => [],
        "errors" => []
    ];
    if ($_SERVER["REQUEST_METHOD"] === "POST" && !empty($_FILES["images"])) {
        foreach ($_FILES["images"]["tmp_name"] as $index => $tmpName) {
            if ($_FILES["images"]["error"][$index] === UPLOAD_ERR_OK) {
                $fileSize = $_FILES["images"]["size"][$index];
                if ($fileSize > $maxFileSize) {
                    $response["errors"][] = "Dosya çok büyük: " . $_FILES["images"]["name"][$index];
                    continue;
                }
                $fileExt = strtolower(pathinfo($_FILES["images"]["name"][$index], PATHINFO_EXTENSION));
                if (!in_array($fileExt, $allowedExts)) {
                    $response["errors"][] = "Geçersiz dosya türü: " . $_FILES["images"]["name"][$index];
                    continue;
                }
                $newFileName = time() . "-" . bin2hex(random_bytes(5)) . "." . $fileExt;
                $filePath = $uploadDir . $newFileName;
                if (move_uploaded_file($tmpName, $filePath)) {
                    $fileUrl = $serverAddress . $newFileName;
                    $response["files"][] = $fileUrl;
                } else {
                    $response["errors"][] = "Dosya yüklenemedi: " . $_FILES["images"]["name"][$index];
                }
            } else {
                $response["errors"][] = "Dosya hatası: " . $_FILES["images"]["name"][$index];
            }
        }
        $response["success"] = !empty($response["files"]);
        $response["message"] = $response["success"] ? "Yükleme başarılı." : "Hiçbir dosya yüklenemedi.";
        echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
        exit;
    } else {
        echo json_encode([
            "success" => false,
            "message" => "Geçersiz istek veya dosya yüklenmedi.",
            "info" => Dosya Upload Sistemi by Convex v1.0"
        ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
        exit;
    }
    ?>
    js ve css lazım olursa onlarıda gönderebilirim
  • 03-04-2025, 01:49:03
    #4
    sQlice adlı üyeden alıntı: mesajı görüntüle
    işine yararmı bilmem ama bir kaç sitede bu şekilde kullanıyorum bast kendim yazmıştım
    <?php
    header("Access-Control-Allow-Origin: *");
    header("Access-Control-Allow-Methods: POST, OPTIONS");
    header("Access-Control-Allow-Headers: Content-Type");
    header("Content-Type: application/json");
    $uploadDir = __DIR__ . "ifupload/";
    if (!file_exists($uploadDir)) {
        mkdir($uploadDir, 0777, true);
    }
    $maxFileSize = 100 * 1024 * 1024;
    $allowedExts = [
        "jpg", "jpeg", "png", "gif", "webp", "bmp", "svg",
        "mp4", "mov", "avi", "mkv", "wmv", "flv", "webm",
        "mp3", "wav", "ogg", "flac",
        "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx",
        "zip", "rar", "7z", "tar", "gz"
    ];
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https" : "http";
    $serverAddress = rtrim($protocol . "://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']), "/") . "/ifupload/";
    $response = [
        "success" => false,
        "message" => "",
        "files" => [],
        "errors" => []
    ];
    if ($_SERVER["REQUEST_METHOD"] === "POST" && !empty($_FILES["images"])) {
        foreach ($_FILES["images"]["tmp_name"] as $index => $tmpName) {
            if ($_FILES["images"]["error"][$index] === UPLOAD_ERR_OK) {
                $fileSize = $_FILES["images"]["size"][$index];
                if ($fileSize > $maxFileSize) {
                    $response["errors"][] = "Dosya çok büyük: " . $_FILES["images"]["name"][$index];
                    continue;
                }
                $fileExt = strtolower(pathinfo($_FILES["images"]["name"][$index], PATHINFO_EXTENSION));
                if (!in_array($fileExt, $allowedExts)) {
                    $response["errors"][] = "Geçersiz dosya türü: " . $_FILES["images"]["name"][$index];
                    continue;
                }
                $newFileName = time() . "-" . bin2hex(random_bytes(5)) . "." . $fileExt;
                $filePath = $uploadDir . $newFileName;
                if (move_uploaded_file($tmpName, $filePath)) {
                    $fileUrl = $serverAddress . $newFileName;
                    $response["files"][] = $fileUrl;
                } else {
                    $response["errors"][] = "Dosya yüklenemedi: " . $_FILES["images"]["name"][$index];
                }
            } else {
                $response["errors"][] = "Dosya hatası: " . $_FILES["images"]["name"][$index];
            }
        }
        $response["success"] = !empty($response["files"]);
        $response["message"] = $response["success"] ? "Yükleme başarılı." : "Hiçbir dosya yüklenemedi.";
        echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
        exit;
    } else {
        echo json_encode([
            "success" => false,
            "message" => "Geçersiz istek veya dosya yüklenmedi.",
            "info" => Dosya Upload Sistemi by Convex v1.0"
        ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
        exit;
    }
    ?>
    js ve css lazım olursa onlarıda gönderebilirim
    Çoook teşekkür ederim PM atıyorum.