<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Form completo (dati+immagini)]]></title><description><![CDATA[<p dir="auto">Salve gente.<br />
Ho bisogno di un paio di dritte per iniziare questa cosa che, per me assolutamente sempre acerbo di PHP, mi risulta complicata.<br />
Devo fare, e non per qualche cliente, un form completo che permetta l'inserimento di dati su DB (e fin qui nessun problema) con la possibilità di collegare un massimo di 4 immagini.</p>
<p dir="auto">Mi suggerite link, demo o qualcosa che funzioni?</p>
<p dir="auto">Mi sono lanciato in questa avventura con questo codice, ma non funziona:</p>
<pre><code class="language-php">$db_host = "*"; 
$db_user = "*"; 
$db_password = "*"; 
$db_name = "*"; 

$path_img = 'img/'; 


$db = mysql_connect($db_host, $db_user, $db_password); 
$db_forum = mysql_select_db($db_name, $db); 

  @require 'function.php'; 

  
  $tipi_consentiti = array("image/gif","image/jpeg","image/png"); 

   
  if (@in_array($_FILES['imagefile']['type'], $tipi_consentiti)){  

    @copy ($_FILES['imagefile']['tmp_name'], $path_img . $_FILES['imagefile']['name']); 

    
    $nome = @addslashes($_FILES['imagefile']['name']); 
    $path = $path_img . stripslashes($nome); 
    $tipo = @addslashes($_FILES['imagefile']['type']); 

    
    @makeThumb($path_img,$path,$nome,$tipo); 
  } 
   
    $query = "INSERT INTO `images` (nome,tipo) VALUES('$nome','$tipo')"; 
     
    $query2 = "INSERT INTO `squadra` (ruolo, nome, cognome, numero_maglia) VALUES ('".$_POST['ruolo']."', '".$_POST['nome']."', '".$_POST['cognome']."', '".$_POST['numero_maglia']."')"; 
     
    $res = @mysql_query($query) or die ("&lt;center&gt;ERRORE NELL'INSERIMENTO IMMAGINE. CI SCUSIAMO PER IL DISAGIO&lt;/center&gt;"); 
    $res2 = @mysql_query($query2) or die ("&lt;center&gt;ERRORE DI CONNESSIONE. CI SCUSIAMO PER IL DISAGIO&lt;/center&gt;"); 
    @mysql_close($cn); 

  
    echo "&lt;center&gt;GIOCATORE INSERITo CON SUCCESSO. &lt;br&gt;Chiudi oppure &lt;a href='**.php'&gt;inserisci un nuovo giocatore&lt;/a&gt;&lt;/center&gt;"; 
      
?&gt;
</code></pre>
<p dir="auto">Con questo script, i dati vengono correttamente inseriti nella tabella "squadra", nella tabella "images" vengon scritti i dati, ma nella cartella che dovrebbe contenere le jpg non c'è nulla.<br />
Ovviamente la pagina con la select non stampa nulla!</p>
]]></description><link>https://dev.connect.gt/topic/150021/form-completo-dati-immagini</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 00:14:12 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/150021.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Apr 2011 15:15:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Form completo (dati+immagini) on Mon, 09 May 2011 13:53:04 GMT]]></title><description><![CDATA[<p dir="auto">Guarda un pò in giro. Ci sono articoli tipo <a href="http://www.alessioluffarelli.it/guide_tutorial/web/upload_file_immagini.php" rel="nofollow ugc">questo</a>, il primo che ho trovato, che spiegano come spostare file sul server tramite form.<br />
Se hai dubbi dopo la realizzazione, chiedi pure.</p>
]]></description><link>https://dev.connect.gt/post/991430</link><guid isPermaLink="true">https://dev.connect.gt/post/991430</guid><dc:creator><![CDATA[portapipe]]></dc:creator><pubDate>Mon, 09 May 2011 13:53:04 GMT</pubDate></item></channel></rss>