Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Upload Immagini

  1. #1

    Upload Immagini

    Grazie

    premesso che capisco di asp , ma paraticamente zero di PHP vorrei sapere è possibile modificare , e i quale maniera, il seguente script per permettere solo l'upload di file con estensione jpg e gif ed eventualmente settare la dimensione max dell'immagine, per esempio
    100 X 100.

    Grazie in anticipo per la risposta

    <form name="form1" method="post" action="" enctype="multipart/form-data">
    <input type="file" name="imagefile">


    <input type="submit" name="Submit" value="Invia">
    <?

    if(isset( $Submit ))
    {
    //If the Submitbutton was pressed do:

    if ($_FILES['imagefile']['type'] == "image/gif"){
    $filetest = true;
    }
    else
    {
    $filetest = false;
    }

    if ($_FILES['imagefile']['size'] <= "10000"){
    $filetest = true;
    }
    else
    {
    $filetest = false;
    }




    if ($filetest == true)
    {
    copy ($_FILES['imagefile']['tmp_name'], "public/files/".$_FILES['imagefile']['name'])
    or die ("Impossibile inviare questo file");

    echo "";
    echo "

    <FONT face=\"Century Gothic\" SIZE=\"1\" >Nome: ".$_FILES['imagefile']['name']."</FONT>
    ";
    echo "<FONT face=\"Century Gothic\" SIZE=\"1\">Size: ".$_FILES['imagefile']['size']."</FONT>
    ";
    echo "<FONT face=\"Century Gothic\" SIZE=\"1\">Tipo: ".$_FILES['imagefile']['type']."</FONT>
    ";
    echo "<FONT face=\"Century Gothic\" SIZE=\"1\" COLOR=\"#33CC00\">Caricata con successo</FONT>";

    }
    else {
    echo "";
    echo "<FONT face=\"Century Gothic\" SIZE=\"1\" COLOR=\"#FF0000\">Errore</FONT>(".$_FILES['imagefile']['name'].")(".$_FILES['imagefile']['size'].")";
    }
    }

    ?>
    </form>
    --°^@- COGITO ERGO SUM -@^°--

    http://freeavatars.altervista.org

  2. #2
    Utente di HTML.it L'avatar di xPilux
    Registrato dal
    Jul 2004
    Messaggi
    103
    non ho tempo di scrivere adesso...sto uscendo...
    pero se vuoi puoi guardare QUI
    Se hai qualche domanda falla li, così si parla dello stesso argomento in un thread!
    ciao

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.