Visualizzazione dei risultati da 1 a 10 su 10

Discussione: upload file

  1. #1
    Utente di HTML.it L'avatar di remixe
    Registrato dal
    Aug 2004
    Messaggi
    645

    upload file

    ciao boys

    ho creato una pagina x l'upload dei file tramite un form
    e funziona alla grande.
    L'unico problema lo incontro quando voglio uplodare
    un file pdf (ma penso che se volessi uplodare un immagine
    incontrerei lo stesso problema).
    praticamente mi uploda correttamente il nome del file,
    ma nella directory che ho messo non c'è traccia
    del file pdf.
    Per semplificare il mio problema, vi posto quì sotto l'intero codice
    della pagina il campo interessato è "Pubblicazioni".

    fatemi sapere THANK YOU:

    <?php
    $link = mysql_connect("localhost", "test", "prova")
    or die("Could not connect: " . mysql_error());
    mysql_select_db('news', $link)
    or die ( mysql_error());


    switch ($_GET['action']) {
    case "edit":
    $moviesql = "SELECT * FROM movie
    WHERE id = '" . $_GET['id'] . "'";
    $result = mysql_query($moviesql)
    or die("Invalid query: " . mysql_error());
    $row = mysql_fetch_array($result);
    $telefono = $row['telefono'];
    $email = $row['email'];
    $curriculum = $row['curriculum'];
    $pubblicazioni = \"uploads/".$row['pubblicazioni'];
    $ricerca = $row['ricerca'];
    $didattica = $row['didattica'];
    $download = $row['download'];
    $informazioni = $row['informazioni'];
    $link = $row['link'];

    break;

    default:
    $telefono = "";
    $email = "";
    $curriculum = "";
    $pubblicazioni = "";
    $ricerca = "";
    $didattica = "";
    $download = "";
    $informazioni = "";
    $link = "";
    break;
    }
    ?>
    <html>
    <head>
    <title><?php echo $_GET['action']; ?> movie</title>
    <style type="text/css">
    TD{color:#353535;font-family:verdana}
    TH{color:#FFFFFF;font-family:verdana;background-color:#336699}
    .Stile1 {font-size: 12px}
    .Stile3 {font-size: 11px}
    .Stile5 {color: #FFFFFF}
    body {
    background-color: #e8e8e8;
    }
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    <body>
    <form action="commit.php?action=<?php
    echo $_GET['action']; ?>&type=movie&id=<?php
    echo $_GET['id']; ?>" method="post">
    <table border="0" width="750" cellspacing="1" cellpadding="3"
    bgcolor="#353535" align="center">
    <tr bgcolor="#660000">
    <td colspan="2"><div align="center"><span class="Stile5">EMILIO ROSSI

    <span class="Stile3">SEGRETARIO

    Settore: SCUOLA MEDIA</span></span></div></td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Telefono</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="telefono"
    value="<?php echo $telefono; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">E-Mail</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="email"
    value="<?php echo $email; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Curriculum</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <textarea name="curriculum" cols="60" rows="30" width="400" height="400"><?php echo $curriculum; ?></textarea>
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Pubblicazioni</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="file" name="pubblicazioni"
    value="<?php echo $pubblicazioni; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Ricerca</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="ricerca"
    value="<?php echo $ricerca; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Didattica</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="didattica"
    value="<?php echo $didattica; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Download</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="download"
    value="<?php echo $download; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Informazioni</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="informazioni"
    value="<?php echo $informazioni; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Link</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="link"
    value="<?php echo $link; ?>">
    </td>
    </tr>
    <tr bgcolor="#666666">
    <td colspan="2" align="center">
    <input type="submit" name="SUBMIT" value="<?php
    echo $_GET['action']; ?>">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    nessuno

  2. #2
    Utente di HTML.it L'avatar di Il_Drugo
    Registrato dal
    May 2006
    Messaggi
    1,220
    Prima di analizzare il codice ti faccio al domanda di rito: hai il diritto di scrittura sulla cartella in cui metti gli uploads?

  3. #3
    Utente di HTML.it L'avatar di remixe
    Registrato dal
    Aug 2004
    Messaggi
    645

    re

    ciao

    si ho appena controllato e settato i permessi della cartella uploads a 777
    quindi sia lettura che scrittura, però ahimè l'upload del pdf non va a buon fine.
    credo sia un problema di codice a questo punto, ma la cosa strana è che non mi da errori
    come è di rito in queste occasioni.
    Ripeto il nome del file me lo uploda tranquillamente nel campo "Pubblicazioni" che ho settato (db)
    con la proprietà "Text" però nella cartella uploads del pdf non ce ne è traccia.

    fammi sapere


    grazie ancora
    nessuno

  4. #4
    Utente di HTML.it L'avatar di Il_Drugo
    Registrato dal
    May 2006
    Messaggi
    1,220
    ehm....forse sono ciucco io...ma in quel codice non c'è nulla che esegua un upload. E' una query SELECT e poi un form precompilato prondo per la modifica di una entry....ma nessuna move_uploaded_file()....

  5. #5
    Scusa ma dov'è il codice di inserimento nel db e soprattutto della copia del file in questione?

  6. #6
    Utente di HTML.it L'avatar di remixe
    Registrato dal
    Aug 2004
    Messaggi
    645

    re

    devo aver fatto qualche macello

    premetto che sono uno smanettone non proprio programmatore

    dunque ho corretto il codice in questo modo (ho inserito l'INSERT):

    <?php
    $link = mysql_connect("localhost", "test", "prova")
    or die("Could not connect: " . mysql_error());
    mysql_select_db('news', $link)
    or die ( mysql_error());


    switch ($_GET['action']) {
    case "edit":
    $moviesql = "SELECT * FROM movie
    WHERE id = '" . $_GET['id'] . "'";
    $result = mysql_query($moviesql)
    or die("Invalid query: " . mysql_error());
    $row = mysql_fetch_array($result);
    $telefono = $row['telefono'];
    $email = $row['email'];
    $curriculum = $row['curriculum'];
    $pubblicazioni = $row['pubblicazioni'];
    $ricerca = $row['ricerca'];
    $didattica = $row['didattica'];
    $download = $row['download'];
    $informazioni = $row['informazioni'];
    $link = $row['link'];

    break;

    default:
    $telefono = "";
    $email = "";
    $curriculum = "";
    $pubblicazioni = "";
    $ricerca = "";
    $didattica = "";
    $download = "";
    $informazioni = "";
    $link = "";
    break;
    }
    ?>

    <?php
    $uploaddir = './uploads';
    //fotografie corrisponde alla cartella nella quale vorrei fossero salvate le immagini
    $uploadfile = $uploaddir . basename($_FILES['pubblicazioni']['name']);

    if (move_uploaded_file($_FILES['pubblicazioni']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
    } else {
    echo "File is invalid.\n!";
    }
    print_r($_FILES);

    $query = "INSERT INTO movie (Pubblicazioni) VALUES
    ('".$_FILES['upfile'] ['name']."')";

    $Result=mysql_query($query) or die ("Errore nella query:" . mysql_error());
    echo "Record inserito con successo";
    echo $_FILE['upfile']['name'];
    ?>

    <html>
    <head>
    <title><?php echo $_GET['action']; ?> movie</title>
    <style type="text/css">
    TD{color:#353535;font-family:verdana}
    TH{color:#FFFFFF;font-family:verdana;background-color:#336699}
    .Stile1 {font-size: 12px}
    .Stile3 {font-size: 11px}
    .Stile5 {color: #FFFFFF}
    body {
    background-color: #e8e8e8;
    }
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    <body>
    <form ENCTYPE="multipart/form-data" action="commit.php?action=<?php
    echo $_GET['action']; ?>&type=movie&id=<?php
    echo $_GET['id']; ?>" method="post">
    <table border="0" width="750" cellspacing="1" cellpadding="3"
    bgcolor="#353535" align="center">
    <tr bgcolor="#660000">
    <td colspan="2"><div align="center"><span class="Stile5">EMILIO ROSSI

    <span class="Stile3">SEGRETARIO

    Settore: SCUOLA MEDIA</span></span></div></td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Telefono</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="telefono"
    value="<?php echo $telefono; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">E-Mail</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="email"
    value="<?php echo $email; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Curriculum</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <textarea name="curriculum" cols="60" rows="30" width="400" height="400"><?php echo $curriculum; ?></textarea>
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Pubblicazioni</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="file" name="pubblicazioni"
    value="<?php echo $pubblicazioni; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Ricerca</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="ricerca"
    value="<?php echo $ricerca; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Didattica</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="didattica"
    value="<?php echo $didattica; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Download</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="download"
    value="<?php echo $download; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Informazioni</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="informazioni"
    value="<?php echo $informazioni; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Link</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="link"
    value="<?php echo $link; ?>">
    </td>
    </tr>
    <tr bgcolor="#666666">
    <td colspan="2" align="center">
    <input type="submit" name="SUBMIT" value="<?php
    echo $_GET['action']; ?>">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    nessuno

  7. #7
    Prova a cambiare questo:

    $uploaddir = './uploads';
    //fotografie corrisponde alla cartella nella quale vorrei fossero salvate le immagini
    $uploadfile = $uploaddir . basename($_FILES['pubblicazioni']['name']);

    in :

    $uploaddir = 'uploads/';
    //fotografie corrisponde alla cartella nella quale vorrei fossero salvate le immagini
    $uploadfile = $uploaddir . $_FILES['pubblicazioni']['name'];

    basename non è necessario indica già il nome del file questo -> $_FILES['pubblicazioni']['name']


  8. #8
    Utente di HTML.it L'avatar di remixe
    Registrato dal
    Aug 2004
    Messaggi
    645

    re

    ciao amici, la situazione è più complessa del previsto.
    Come dicono negli USA non tenete presenti le pagine di cui abbiamo parlato
    fino a questo momento.
    E' stata una mia dimenticanza PARDON.
    Dunque io in realtà ho 3 file (un piccolissimo CMS).

    Il primo file che è la index semplicemente estrae da database una serie di campi il codice è questo:

    <?php
    $link = mysql_connect("localhost", "", "")
    or die("Could not connect: " . mysql_error());
    mysql_select_db('', $link)
    or die(mysql_error());
    ?>
    <html>
    <head>
    <title>Movie database</title>
    <style type="text/css">
    TD{color:#353535;font-family:verdana}
    TH{color:#FFFFFF;font-family:verdana;background-color:#336699}
    .Stile3 {font-size: 11px}
    .Stile4 {
    font-size: 12px;
    color: #000000;
    }
    a:link {
    color: #ffffff;
    text-decoration: none;
    }
    a:visited {
    text-decoration: none;
    color: #ffffff;
    }
    a:hover {
    text-decoration: underline;
    color: #ffffff;
    }
    a:active {
    text-decoration: none;
    color: #ffffff;
    }
    body {
    background-color: #E8E8E8;
    }
    .Stile5 {color: #FFFFFF}
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    <body>
    <table border="0" width="600" cellspacing="1" cellpadding="3"
    bgcolor="#353535" align="center">
    <tr bgcolor="#660000">
    <td colspan="3" align="center"><span class="Stile5">
    Beniamino Terzo CENCI GOGA

    <span class="Stile3">PROFESSORE ASSOCIATO

    Settore: VET/04 ISPEZIONE DEGLI ALIMENTI DI ORIGINE ANIMALE </span> </span></td>
    </tr>
    <?php
    $moviesql = "SELECT * FROM movie";
    $result = mysql_query($moviesql)
    or die("Invalid query: " . mysql_error());
    while ($row = mysql_fetch_array($result)) {
    ?>
    <tr>
    <td bgcolor="#CCCCCC" width="11%">
    <span class="Stile4">Telefono:</span>
    </td>
    <td bgcolor="#FFFFFF" width="89%"><?php echo $row['telefono'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC">
    <span class="Stile4">E-Mail:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['email'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC">
    <span class="Stile4">Curriculum:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['curriculum'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC">
    <span class="Stile4">Pubblicazioni:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['pubblicazioni'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC">
    <span class="Stile4">Ricerca:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['ricerca'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC">
    <span class="Stile4">Didattica:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['didattica'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC"> <span class="Stile4">Download:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['download'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC">
    <span class="Stile4">Informazioni:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['informazioni'];?></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC">
    <span class="Stile4">Link:</span>
    </td>
    <td bgcolor="#FFFFFF"><?php echo $row['link'];?></td>
    </tr>
    <tr bgcolor="#666666"><td colspan="2" align="right">
    <table width="115" height="30" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td height="24" bgcolor="#660000" class="bott" align="center"><a href="movie2.php?action=edit&id=<?php
    echo $row['id']; ?>">[AGGIORNA]</a></td>
    </tr>
    </table>

    </td>
    </tr>
    <?php
    }
    ?>

    </table>
    </body>
    </html>

    CLIKKANDO SUL PULSANTE "AGGIORNA" MI MANDA alla seconda pagina movie2.php che hai il seguente codice:

    ?php
    $link = mysql_connect("localhost", "", "")
    or die("Could not connect: " . mysql_error());
    mysql_select_db('', $link)
    or die ( mysql_error());


    switch ($_GET['action']) {
    case "edit":
    $moviesql = "SELECT * FROM movie
    WHERE id = '" . $_GET['id'] . "'";
    $result = mysql_query($moviesql)
    or die("Invalid query: " . mysql_error());
    $row = mysql_fetch_array($result);
    $telefono = $row['telefono'];
    $email = $row['email'];
    $curriculum = $row['curriculum'];
    $pubblicazioni = $row['pubblicazioni'];
    $ricerca = $row['ricerca'];
    $didattica = $row['didattica'];
    $download = $row['download'];
    $informazioni = $row['informazioni'];
    $link = $row['link'];
    break;

    default:
    $telefono = "";
    $email = "";
    $curriculum = "";
    $pubblicazioni = "";
    $ricerca = "";
    $didattica = "";
    $download = "";
    $informazioni = "";
    $link = "";
    break;
    }
    ?>
    <html>
    <head>
    <title><?php echo $_GET['action']; ?> movie</title>
    <style type="text/css">
    TD{color:#353535;font-family:verdana}
    TH{color:#FFFFFF;font-family:verdana;background-color:#336699}
    .Stile1 {font-size: 12px}
    .Stile3 {font-size: 11px}
    .Stile5 {color: #FFFFFF}
    body {
    background-color: #e8e8e8;
    }
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
    <body>
    <form ENCTYPE="multipart/form-data" action="commit.php?action=<?php
    echo $_GET['action']; ?>&type=movie&id=<?php
    echo $_GET['id']; ?>" method="post">
    <table border="0" width="750" cellspacing="1" cellpadding="3"
    bgcolor="#353535" align="center">
    <tr bgcolor="#660000">
    <td colspan="2"><div align="center"><span class="Stile5">EMILIO ROSSI

    <span class="Stile3">SEGRETARIO

    Settore: SCUOLA MEDIA</span></span></div></td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Telefono</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="telefono"
    value="<?php echo $telefono; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">E-Mail</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="email"
    value="<?php echo $email; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Curriculum</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <textarea name="curriculum" cols="60" rows="30" width="400" height="400"><?php echo $curriculum; ?></textarea>
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Pubblicazioni</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="file" name="pubblicazioni"
    value="<?php echo $pubblicazioni; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Ricerca</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="ricerca"
    value="<?php echo $ricerca; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Didattica</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="didattica"
    value="<?php echo $didattica; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Download</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="download"
    value="<?php echo $download; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Informazioni</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="informazioni"
    value="<?php echo $informazioni; ?>">
    </td>
    </tr>
    <tr>
    <td bgcolor="#cccccc" width="14%"><span class="Stile1">Link</span></td>
    <td bgcolor="#FFFFFF" width="86%">
    <input type="text" name="link"
    value="<?php echo $link; ?>">
    </td>
    </tr>
    <tr bgcolor="#666666">
    <td colspan="2" align="center">
    <input type="submit" name="SUBMIT" value="<?php
    echo $_GET['action']; ?>">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    INFINE LA TERZA ED ULTIMA PAGINA CHE PROCESSA TUTTI I DATI DELLA SECONDA e si chiama commit.php il cui codice è questo:

    <?php
    // COMMIT ADD AND EDITS
    $link = mysql_connect("localhost", "", "")
    or die("Could not connect: " . mysql_error());
    mysql_select_db('archimede', $link)
    or die ( mysql_error());
    switch ($_GET['action']) {
    case "edit":
    switch ($_GET['type']) {
    case "movie":
    $sql = "UPDATE movie SET
    telefono = '" . $_POST['telefono'] . "',
    email = '" . $_POST['email'] . "',
    curriculum = '" . $_POST['curriculum'] . "',
    pubblicazioni = '" .$_FILES['pubblicazioni']."',
    ricerca = '" . $_POST['ricerca'] . "',
    didattica = '" . $_POST['didattica'] . "',
    download = '" . $_POST['download'] . "',
    informazioni = '" . $_POST['informazioni'] . "',
    link = '" . $_POST['link'] . "'
    WHERE id = '" . $_GET['id'] . "'";
    break;
    }
    break;
    case "add":
    switch ($_GET['type']) {
    case "movie":
    $sql = "INSERT INTO movie
    (telefono,
    email,
    curriculum,
    pubblicazioni,
    ricerca,
    didattica,
    download,
    informazioni,
    link)
    VALUES
    ('" . $_POST['telefono'] . "',
    '" . $_POST['email'] . "',
    '" . $_POST['curriculum'] . "',
    '" . $_FILES['pubblicazioni'] . "',
    '" . $_POST['ricerca'] . "',
    '" . $_POST['didattica'] . "',
    '" . $_POST['download'] . "',
    '" . $_POST['informazioni'] . "',
    '" . $_POST['link'] . "')";



    break;
    }
    break;
    }
    if (isset($sql) && !empty($sql)) {
    echo "";
    $result = mysql_query($sql)
    or die("Invalid query: " . mysql_error());
    ?><style type="text/css">
    <!--
    body {
    background-color: #E8E8E8;
    }
    -->
    </style>
    <p align="center" style="color:#FF0000">
    Le informazioni sono state aggiornate correttamente. Clicca quì per visualizzare gli avvenuti inserimenti
    </p>
    <?php
    }
    ?>

    Ora il problema cruciale che credo mi sia rimasto da risolvere è dove e come mettere la directory
    dove devono essere uplodati i file pdf nel campo pubblicazioni.
    nessuno

  9. #9
    Utente di HTML.it L'avatar di remixe
    Registrato dal
    Aug 2004
    Messaggi
    645

    re

    nessuno che può aiutarmi?...HELP ME PLEASE
    nessuno

  10. #10
    Utente di HTML.it
    Registrato dal
    Jun 2006
    Messaggi
    4
    Non ho la soluzione al tuo problema ma sicuramente qualche suggerimento per trovarne una.
    Innanzitutto da quanto mi sembra di capire, stai copiando codice a destra e a manca sperando che qualcosa funzioni.

    Se vuoi risolvere il problema devi scomporlo nelle sue parti essenziali e poi, eventualmente, aggiungere fronzoli ...

    Per caricare un file ti servono:

    un form

    <form action="" method="get" enctype="multipart/form-data">
    <input type="file" name="file_da_caricare">
    <input type="submit" name="Submit" value="Submit">
    </form>

    con un input di tipo file e questo suppongo che tu lo abbia.

    questo form ti resituisce una variabile che ha il nome del campo: file_da_caricare in questo caso

    da questa variabile puoi estrarre il nome del file
    con :

    $_FILES['file_da_caricare']['name']

    con move_uploaded_file() gli dai un nome e una destinazione.

    Quindi direi:
    1) vedi se il nome che ti da il form corrisponde con quello su $_FILES
    2) leggiti la sintassi di move_uploaded ....

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.