Modif Php Upload File?

Bagaimana Modif Php Upload File yang benar?
ini html pemanggilnya:


<!DOCTYPE html>

<html>

<body>
<form action="upload.php" method="post" enctype="multipart/form-data">

Select image to upload:

<input type="file" name="fileToUpload" id="fileToUpload">

<input type="submit" value="Upload Image" name="submit">

</form>
</body>

</html>

Ini upload.php:


<?php

$target_dir = "uploads/";

$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

$uploadOk = 1;

$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);

// Check if image file is a actual image or fake image

if(isset($_POST["submit"])) {

$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);

if($check !== false) {

echo "File is an image - " . $check["mime"] . ".";

$uploadOk = 1;

} else {

echo "File is not an image.";

$uploadOk = 0;

}

}

?>

Maksud saya ,saya ingin menganti code”<input type=”file” name=”fileToUpload” id=”fileToUpload”>” dengan code”<input type=”text” name=”fileToUpload” id=”fileToUpload”>”..

Karena filenya berada di hosting site ,Contoh http://myhost.com/file1.img

Terima kasih,tolong pencerahannya :)

SMP Ditanyakan on 6 September 2016 pada Blog/Web.
Tambah Komentar
  • 1 Jawaban

    diganti seperti berikut gan,

    
    <?php
    
    $url = "http://xxxxxxx.com/dota.zip";
    
    $file = "nama-file.zip";
    
    $import = file_get_contents($url);
    
    $open = fopen($file, ‘w’);
    
    fwrite($open, $import);
    
    fclose($open);
    
    ?>
    
    

    coba dlu gan

    Megister Terjawab on 7 September 2016

    Contoh Html pemanggilnya giman tu gan?

    on 8 September 2016.
    Tambah Komentar
    Loading...

    Smilies Kaskus

    Dengan memposting jawaban, anda setuju dengan Kebijakan Privasi dan ketentuan layanan.