Visualizzazione dei risultati da 1 a 6 su 6

Discussione: upload doppio

  1. #1

    upload doppio

    ciao a tutti volevo sapere se é possibile fare l'upload di una immagine
    solo che quando fa l'upload vorrei che una copia dell'immagine la inserisca in una cartella e un altra copia in un altra cartella...
    e poi vorrei sapere se é possibile che durante l'upload ridimensioni l'immagine con dimensioni indicategli da me..

  2. #2
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    si, puoi fare entrambe le cose:
    per il primo upload
    http://it2.php.net/manual/en/functio...oaded-file.php

    per la copia
    http://it2.php.net/copy

    per ridimensionare
    http://it.php.net/image
    think simple think ringo

  3. #3
    grazie mille ... ma ho un altra cosa da chiedere ...


    io ho trovato sul sito questo script per gli uploads ... ma come va modificato se voglio che vengano anche rinominati i file che vengono uplodati (...che italiano)

  4. #4
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    quale script??
    think simple think ringo

  5. #5
    ops eccolo


    codice:
    <?
    //user defined variables
    $abpath = "/home/zachwhit/public_html/demo/imgz11"; //Absolute path to where images are uploaded. No trailing slash
    $sizelim = "no"; //Do you want size limit, yes or no
    $size = "2500000"; //What do you want size limited to be if there is one
    
    //all image types to upload
    $cert1 = "image/pjpeg"; //Jpeg type 1
    $cert2 = "image/jpeg"; //Jpeg type 2
    $cert3 = "image/gif"; //Gif type
    $cert4 = "image/ief"; //Ief type
    $cert5 = "image/png"; //Png type
    $cert6 = "image/tiff"; //Tiff type
    $cert7 = "image/bmp"; //Bmp Type
    $cert8 = "image/vnd.wap.wbmp"; //Wbmp type
    $cert9 = "image/x-cmu-raster"; //Ras type
    $cert10 = "image/x-x-portable-anymap"; //Pnm type
    $cert11 = "image/x-portable-bitmap"; //Pbm type
    $cert12 = "image/x-portable-graymap"; //Pgm type
    $cert13 = "image/x-portable-pixmap"; //Ppm type
    $cert14 = "image/x-rgb"; //Rgb type
    $cert15 = "image/x-xbitmap"; //Xbm type
    $cert16 = "image/x-xpixmap"; //Xpm type
    $cert17 = "image/x-xwindowdump"; //Xwd type
    
    $log = "";
    
    //begin upload 1
    
    
    
    //checks if file exists
    if ($imgz1_name == "") {
    $log .= "No file selected for upload 1
    ";
    }
    if ($imgz1_name != "") {
    //checks if file exists
    if (file_exists("$abpath/$imgz1_name")) {
    $log .= "File 1 already existed
    ";
    } else {
    
    //checks if files to big
    if ($sizelim == "yes") {
    if ($imgz1_size > $size) {
    $log .= "File 1 was too big
    ";
    }
    }
    
    //Checks if file is an image
    
    
    if (($imgz1_type == $cert1) or ($imgz1_type == $cert2) or ($imgz1_type == $cert3) or ($imgz1_type == $cert4) or ($imgz1_type == $cert5) or ($imgz1_type == $cert6) or ($imgz1_type == $cert7) or ($imgz1_type == $cert8) or ($imgz1_type == $cert9) or ($imgz1_type == $cert10) or ($imgz1_type == $cert11) or ($imgz1_type == $cert12) or ($imgz1_type == $cert13) or ($imgz1_type == $cert14) or ($imgz1_type == $cert15) or ($imgz1_type == $cert16) or ($imgz1_type == $cert17)) {
    @copy($imgz1, "$abpath/$imgz1_name") or $log .= "Couldn't copy image 1 to server
    ";
    if (file_exists("$abpath/$imgz1_name")) {
    $log .= "File 1 was uploaded
    ";
    }
    } else {
    $log .= "File 1 is not an image
    ";
    }
    }
    }

  6. #6
    Moderatore di Server Apache L'avatar di marketto
    Registrato dal
    Sep 2001
    Messaggi
    5,858
    ti conviene modificare lo script per non dover richiedere il register global on.
    http://forum.html.it/forum/showthrea...hreadid=245215

    per rinominare il file devi agire su questa riga di codice:
    @copy($imgz1, "$abpath/$imgz1_name")

    copy(vecchio file, nuovo file);
    think simple think ringo

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.