<?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[HELP... dove sbaglio ?]]></title><description><![CDATA[<p dir="auto">Salve tutti, vorrei con questa funzione che, a prescindere se l'immagine esiste come copertina o meno, il ciclo foreach sostituisse, se true, il l'immagine upl.<br />
Ora, lo script funziona benissimo, ,ma la vaiabile "V non viene passata, è come se l'array "pic" che viene valorizzato alla fonte, non passasse il valore alla variabile ultima $copertina.<br />
Dove sbaglio ?</p>
<pre><code class="language-php">function nm(){
    if(isset($_POST['nm'])){
        if($_POST['as1'] != $_POST['as2']) die("&lt;div class='jumbotron' align='center'&gt;ATTENZIONE: Codice antispam mancante o non corretto, impossibile continuare&lt;/div&gt;&lt;META HTTP-EQUIV=REFRESH CONTENT=\"1; URL=index.php\"&gt;");
        $origpath="images/articoli";
        if($_FILES['upl']['error'] == 0){
            $allowed = array('jpg', 'jpeg', 'gif', 'png');
            $extension = pathinfo($_FILES['upl']['name'], PATHINFO_EXTENSION);
            if(file_exists("$origpath" . $_FILES['upl']['name'])) die ("&lt;div class='jumbotron' align='center'&gt;Questo file è già presente nel database. Impossibile continuare&lt;/div&gt;&lt;META HTTP-EQUIV=REFRESH CONTENT=\"3; URL=index.php\"&gt;");
            if(!in_array(strtolower($extension), $allowed)){
            echo "&lt;div class='well' align='center'&gt;&lt;h4&gt; Formato non valido &lt;/h4&gt;&lt;/div&gt;";
            exit;}
            $sizee=$_FILES['upl']['size'];
            $peso=1000000;
            if($sizee &gt; $peso) die ("L'immagine che si tenta di caricare è oltre un megabyte &lt;a href='index.php'&gt; [chiudi]&lt;/a&gt;");
            $imgsize=getimagesize($_FILES['upl']['tmp_name'][$count]);
            $larghezza=800;
            $altezza=600;    
            if($imgsize[0] &gt; $larghezza OR $imgsize[1] &gt; $altezza) die ("L'immagine che si tenta di caricare è troppo grande &lt;a href='index.php'&gt; [chiudi]&lt;/a&gt;");    
            if(move_uploaded_file($_FILES['upl']['tmp_name'], "$origpath"."/".$_FILES['upl']['name'])){
            $data=date("d-m-Y H:m");
            $link="$origpath"."/".$_FILES['upl']['name'];
        }}
        $titolo=htmlentities($_POST['titolo'], ENT_QUOTES);
        $testo=htmlentities($_POST['testo'], ENT_QUOTES);
            $array=$_POST['pic'];
            foreach($array AS $V){
            return $V;
        }
        $copertina=$link.$V;
        $lingua="IT";
        $q=mysql_query("INSERT INTO media (titolo, lingua, testo, categoria, pdf, cartella, link_contenuto, stato) VALUES ('$titolo', '$lingua', '$testo', '$_POST[categoria]', '$pdf', '', '$copertina', '0')");
        die("&lt;div class='jumbotron' align='center'&gt;$GLOBALS[link2] Nuovo Contenuto inserito &lt;/div&gt;&lt;META HTTP-EQUIV=REFRESH CONTENT=\"1; URL=index.php\"&gt;");
    }
}
</code></pre>
]]></description><link>https://dev.connect.gt/topic/238473/help-dove-sbaglio</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 18:34:13 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/238473.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 01 Jul 2019 11:49:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HELP... dove sbaglio ? on Mon, 01 Jul 2019 14:55:21 GMT]]></title><description><![CDATA[<p dir="auto">Risolto potete chiudere grazie.</p>
]]></description><link>https://dev.connect.gt/post/1258686</link><guid isPermaLink="true">https://dev.connect.gt/post/1258686</guid><dc:creator><![CDATA[teox]]></dc:creator><pubDate>Mon, 01 Jul 2019 14:55:21 GMT</pubDate></item></channel></rss>