<?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[Upload file e creazione cartella]]></title><description><![CDATA[<p dir="auto">Salve a tutti,<br />
vorrei risolvere un problemino, ossia fare l'upload ma allo stesso tempo creare anche una cartella in md5 dove andra il file o i files, ora nel mio script sto usando questo:</p>
<pre><code>    move_uploaded_file($_FILES['photoupload']['tmp_name'], "./uploadedfiles/".$_FILES['photoupload']['name']);
    chmod("./uploadedfiles/".$_FILES['photoupload']['name'], 0777);
</code></pre>
<p dir="auto">....che ovviamente invia solo il file dal form, ma come si potrebbe estendere la funzione per l'appunto creare anche una cartella univoca dove andrà il suddetto file?</p>
<p dir="auto">Grazie anticipatamente a tutti ciao Peter</p>
]]></description><link>https://dev.connect.gt/topic/84646/upload-file-e-creazione-cartella</link><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Dec 2026 20:23:19 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/84646.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 07 Oct 2008 14:49:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Upload file e creazione cartella on Thu, 09 Oct 2008 13:23:04 GMT]]></title><description><![CDATA[<p dir="auto">infatti anche questo mi da errore:</p>
<p dir="auto">[Thu Oct 09 15:39:04 2008] [error] [client 192.168.2.2] PHP Notice:  Undefined index:  photo_upload in /var/www/html/uploaderfile/script.php on line 3<br />
[Thu Oct 09 15:39:04 2008] [error] [client 192.168.2.2] PHP Notice:  Undefined index:  photo_upload in /var/www/html/uploaderfile/script.php on line 3<br />
[Thu Oct 09 15:39:04 2008] [error] [client 192.168.2.2] PHP Warning:  move_uploaded_file(./uploadedfiles/_4d159d07b61720a03f051ba113d88bc1cc3dc48b/DSCF0402.JPG) [&lt;a href='function.move-uploaded-file'&gt;function.move-uploaded-file&lt;/a&gt;]: failed to open stream: No such file or directory in /var/www/html/uploaderfile/script.php on line 6<br />
[Thu Oct 09 15:39:04 2008] [error] [client 192.168.2.2] PHP Warning:  move_uploaded_file() [&lt;a href='function.move-uploaded-file'&gt;function.move-uploaded-file&lt;/a&gt;]: Unable to move '/tmp/phptd8Ivx' to './uploadedfiles/_4d159d07b61720a03f051ba113d88bc1cc3dc48b/DSCF0402.JPG' in /var/www/html/uploaderfile/script.php on line 6</p>
<p dir="auto">cmq ripeto questo anche se in md5 funziona perfettamente...solo che mi crea una cartella per ogni file che e presente nell'invio del form</p>
<p dir="auto">&lt;?php<br />
$target = basename( $_FILES['photoupload']['name']);<br />
umask(0);<br />
$md5 = md5_file($_FILES['photoupload']['tmp_name']);<br />
if(!file_exists($md5)) mkdir($md5);<br />
umask(0);<br />
if(move_uploaded_file($_FILES['photoupload']['tmp_name'], $md5 . "/" . $target))<br />
echo "DIR: $md5 ".rawurlencode($target);<br />
else<br />
echo "Sorry, there was a problem uploading your file.";<br />
?&gt;</p>
<p dir="auto">sarebbe auspicabile che mettesse tutto dentro una unica cartella (md5)!!!!</p>
]]></description><link>https://dev.connect.gt/post/766694</link><guid isPermaLink="true">https://dev.connect.gt/post/766694</guid><dc:creator><![CDATA[peterminnow]]></dc:creator><pubDate>Thu, 09 Oct 2008 13:23:04 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Thu, 09 Oct 2008 12:58:18 GMT]]></title><description><![CDATA[<p dir="auto">uh scusa, errori che non avevo visto<img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/559d73b1-6433-4f6d-8068-61f9dfa0017d-tupitupi.gif?v=2190ae3dadd" class="not-responsive emoji emoji-customizations emoji--yuppi" style="height:1.4em;width:auto;vertical-align:middle" title=":yuppi:" alt="" /> :</p>
<pre><code class="language-php">
</code></pre>
<p dir="auto">$dir_name_file = $<em>FILES['photo_upload']['name']."</em>".sha1(md5(uniqid(rand().$_FILES['photo_upload']['name'],true)));<br />
mkdir($dir_name_file, 0777);</p>
<pre><code>    move_uploaded_file($_FILES['photoupload']['tmp_name'], "./uploadedfiles/".$dir_name_file."/".$_FILES['photoupload']['name'])or die("Impossibile eseguire l\' upload!");
</code></pre>
<p dir="auto">echo "Upload Ok!";</p>
<p dir="auto">E comunque, il file non viene inviato!<br />
Undefined index:  photo_upload in /var/www/html/uploaderfile/script.php on line 7<br />
No such file or directory in /var/www/html/uploaderfile/script.php on line 10</p>
<p dir="auto">Il file non c'è!!;)</p>
]]></description><link>https://dev.connect.gt/post/766653</link><guid isPermaLink="true">https://dev.connect.gt/post/766653</guid><dc:creator><![CDATA[ilnetsurfer]]></dc:creator><pubDate>Thu, 09 Oct 2008 12:58:18 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Thu, 09 Oct 2008 12:56:07 GMT]]></title><description><![CDATA[<p dir="auto">cmq per il momento sto usando questo, anche in md5 e funziona, ossia mi crea la cartella e all'interno il file....il problema è sempre il solito, con un invio multiplo si creano tante cartelle per quanti sono i file inviati......e non una unica cartella con tutti i file dentro!!!</p>
<p dir="auto">####################################################<br />
&lt;?php<br />
$target = basename( $_FILES['photoupload']['name']);<br />
umask(0);<br />
$md5 = md5_file($_FILES['photoupload']['tmp_name']);<br />
if(!file_exists($md5)) mkdir($md5);<br />
umask(0);<br />
if(move_uploaded_file($_FILES['photoupload']['tmp_name'], $md5 . "/" . $target))<br />
echo "DIR: $md5 ".rawurlencode($target);<br />
else<br />
echo "Sorry, there was a problem uploading your file.";<br />
?&gt;<br />
####################################################</p>
]]></description><link>https://dev.connect.gt/post/766692</link><guid isPermaLink="true">https://dev.connect.gt/post/766692</guid><dc:creator><![CDATA[peterminnow]]></dc:creator><pubDate>Thu, 09 Oct 2008 12:56:07 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Thu, 09 Oct 2008 12:51:29 GMT]]></title><description><![CDATA[<p dir="auto">...ancora nulla</p>
<p dir="auto">errori Apache:</p>
<p dir="auto">[Thu Oct 09 15:09:18 2008] [error] [client 192.168.2.2] PHP Notice:  Undefined index:  photo_upload in /var/www/html/uploaderfile/script.php on line 7<br />
[Thu Oct 09 15:09:18 2008] [error] [client 192.168.2.2] PHP Notice:  Undefined index:  photo_upload in /var/www/html/uploaderfile/script.php on line 7<br />
[Thu Oct 09 15:09:18 2008] [error] [client 192.168.2.2] PHP Warning:  move_uploaded_file(./uploadedfiles/_2c220c0f32f4dd247bad59314a56e286366b3f70/DSCF0404.JPG) [&lt;a href='function.move-uploaded-file'&gt;function.move-uploaded-file&lt;/a&gt;]: failed to open stream: No such file or directory in /var/www/html/uploaderfile/script.php on line 10<br />
[Thu Oct 09 15:09:18 2008] [error] [client 192.168.2.2] PHP Warning:  move_uploaded_file() [&lt;a href='function.move-uploaded-file'&gt;function.move-uploaded-file&lt;/a&gt;]: Unable to move '/tmp/phpEBRjLO' to './uploadedfiles/_2c220c0f32f4dd247bad59314a56e286366b3f70/DSCF0404.JPG' in /var/www/html/uploaderfile/script.php on line 10<br />
[Thu Oct 09 15:09:18 2008] [error] [client 192.168.2.2] PHP Warning:  Wrong parameter count for chmod() in /var/www/html/uploaderfile/script.php on line 12</p>
]]></description><link>https://dev.connect.gt/post/766693</link><guid isPermaLink="true">https://dev.connect.gt/post/766693</guid><dc:creator><![CDATA[peterminnow]]></dc:creator><pubDate>Thu, 09 Oct 2008 12:51:29 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Thu, 09 Oct 2008 12:38:07 GMT]]></title><description><![CDATA[<pre><code class="language-php">$dir_name_file = $_FILES['photo_upload']['name']."_".sha1(md5(uniqid(rand().$_FILES['photo_upload']['name'],true)));
mkdir($dir_name_file, 0777);

        if(@move_uploaded_file($_FILES['photoupload']['tmp_name'], "./uploadedfiles/".$dir_name_file."/".$_FILES['photoupload']['name']);
        chmod("./uploadedfiles/".$_FILES['photoupload']['name'])){
echo "Upload Ok!";
}else{
echo "Impossibile terminare l'upload!";
}
</code></pre>
<p dir="auto">Comunque, il file non viene uploadato correttamente...<br />
se l'immagine si chiama mio.jpg, la cartella dovrebbe essere mio.jpg_9wefy7237g27f(ecc...)..<br />
infatti, endefined index vuol dire che la variabile non esiste...<br />
$_FILES['photoalbum'] non esiste...</p>
]]></description><link>https://dev.connect.gt/post/766651</link><guid isPermaLink="true">https://dev.connect.gt/post/766651</guid><dc:creator><![CDATA[ilnetsurfer]]></dc:creator><pubDate>Thu, 09 Oct 2008 12:38:07 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Thu, 09 Oct 2008 12:28:19 GMT]]></title><description><![CDATA[<p dir="auto">....nulla non funziona!!!...</p>
<p dir="auto">questi i log di Apache:</p>
<p dir="auto">[Thu Oct 09 14:44:49 2008] [error] [client 192.168.2.2] PHP Notice:  Undefined index:  photo_upload in /var/www/html/uploaderfile/script.php on line 7<br />
[Thu Oct 09 14:44:49 2008] [error] [client 192.168.2.2] PHP Notice:  Undefined index:  photo_upload in /var/www/html/uploaderfile/script.php on line 7<br />
[Thu Oct 09 14:44:49 2008] [error] [client 192.168.2.2] PHP Warning:  move_uploaded_file(./uploadedfiles/_83319ac3d9a6992be7cf8aebf029924b98420b26/DSCF0378.JPG) [&lt;a href='function.move-uploaded-file'&gt;function.move-uploaded-file&lt;/a&gt;]: failed to open stream: No such file or directory in /var/www/html/uploaderfile/script.php on line 10<br />
[Thu Oct 09 14:44:49 2008] [error] [client 192.168.2.2] PHP Warning:  move_uploaded_file() [&lt;a href='function.move-uploaded-file'&gt;function.move-uploaded-file&lt;/a&gt;]: Unable to move '/tmp/phpXaND05' to './uploadedfiles/_83319ac3d9a6992be7cf8aebf029924b98420b26/DSCF0378.JPG' in /var/www/html/uploaderfile/script.php on line 10<br />
[Thu Oct 09 14:44:49 2008] [error] [client 192.168.2.2] PHP Warning:  chmod() [&lt;a href='function.chmod'&gt;function.chmod&lt;/a&gt;]: No such file or directory in /var/www/html/uploaderfile/script.php on line 11</p>
<p dir="auto">..poi vorrei aggiungere un'altra problematica, ossia che dal form posso aggiungere altri file per l'upload e quindi altri cosi detti slot di e lui ovviamente mi crea una cartella per ogni file e non una cartella con tutti i file inviati con un unico invio!!!</p>
]]></description><link>https://dev.connect.gt/post/766689</link><guid isPermaLink="true">https://dev.connect.gt/post/766689</guid><dc:creator><![CDATA[peterminnow]]></dc:creator><pubDate>Thu, 09 Oct 2008 12:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Thu, 09 Oct 2008 12:02:46 GMT]]></title><description><![CDATA[<pre><code class="language-php"> $dir_name_file = $_FILES['photo_upload']['name']."_".sha1(md5(uniqid(rand().$_FILES['photo_upload']['name'],true)));
mkdir($dir_name_file, 0777);
chmod($dir_name_file, 0777);
        move_uploaded_file($_FILES['photoupload']['tmp_name'], "./uploadedfiles/".$dir_name_file."/".$_FILES['photoupload']['name']);
        chmod("./uploadedfiles/".$_FILES['photoupload']['name'], 0777);
</code></pre>
<p dir="auto"><img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=2190ae3dadd" class="not-responsive emoji emoji-android emoji--wink" style="height:1.4em;width:auto;vertical-align:middle" title=";)" alt="😉" /></p>
]]></description><link>https://dev.connect.gt/post/766650</link><guid isPermaLink="true">https://dev.connect.gt/post/766650</guid><dc:creator><![CDATA[ilnetsurfer]]></dc:creator><pubDate>Thu, 09 Oct 2008 12:02:46 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Tue, 07 Oct 2008 15:56:58 GMT]]></title><description><![CDATA[<p dir="auto">..cosi crea la cartella con permessi 777</p>
<p dir="auto">$dir_name_file = $<em>FILES['photo_upload']['name']."</em>".sha1(md5(uniqid(rand().$_FILES['photo_upload']['name'],true)));<br />
mkdir($dir_name_file, 0777);<br />
chmod($dir_name_file, 0777);<br />
move_uploaded_file($_FILES['photoupload']['tmp_name'], "./uploadedfiles/".$_FILES['photoupload']['name']);<br />
chmod("./uploadedfiles/".$_FILES['photoupload']['name'], 0777);</p>
<p dir="auto">ora pero sempre il problema che non mi inserisce dentro il file!!!</p>
]]></description><link>https://dev.connect.gt/post/766688</link><guid isPermaLink="true">https://dev.connect.gt/post/766688</guid><dc:creator><![CDATA[peterminnow]]></dc:creator><pubDate>Tue, 07 Oct 2008 15:56:58 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Tue, 07 Oct 2008 15:33:21 GMT]]></title><description><![CDATA[<p dir="auto">...ho notato che la cartella creata ha permessi 755 e non 777</p>
]]></description><link>https://dev.connect.gt/post/766691</link><guid isPermaLink="true">https://dev.connect.gt/post/766691</guid><dc:creator><![CDATA[peterminnow]]></dc:creator><pubDate>Tue, 07 Oct 2008 15:33:21 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Tue, 07 Oct 2008 15:21:27 GMT]]></title><description><![CDATA[<p dir="auto">Quasi perfetto!!!...solo che mi crea la cartella tipo questa: _f540fb2b053b40cebf0d96f05e92415b5619e400 ma all'interno non è presente il file!</p>
]]></description><link>https://dev.connect.gt/post/766690</link><guid isPermaLink="true">https://dev.connect.gt/post/766690</guid><dc:creator><![CDATA[peterminnow]]></dc:creator><pubDate>Tue, 07 Oct 2008 15:21:27 GMT</pubDate></item><item><title><![CDATA[Reply to Upload file e creazione cartella on Tue, 07 Oct 2008 15:00:36 GMT]]></title><description><![CDATA[<p dir="auto">Prova con<br />
$dir_name_file  = $<em>FILES['photo_upload']['name']."</em>".sha1(md5(uniqid(rand().$_FILES['photo_upload']['name'],true)));<br />
mkdir($dir_name_file,0777);<br />
move_uploaded_file($_FILES['photoupload']['tmp_name'], "./uploadedfiles/".$dir_file_name);</p>
]]></description><link>https://dev.connect.gt/post/766647</link><guid isPermaLink="true">https://dev.connect.gt/post/766647</guid><dc:creator><![CDATA[ilnetsurfer]]></dc:creator><pubDate>Tue, 07 Oct 2008 15:00:36 GMT</pubDate></item></channel></rss>