<?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[invio file tramite POST in PHP]]></title><description><![CDATA[<p dir="auto">Salve a tutti,</p>
<p dir="auto">avrei una magagna da risolvere.. magari mi potete  dare una mano..</p>
<p dir="auto">io uso questa funzione presa non ricordo dove, :</p>
<pre><code class="language-php">function post_request($url, $data, $method,  $optional_headers = null)
  {
     $params = array('http' =&gt;  array(
           'method' =&gt; $method,
                  'content'  =&gt; $data
               ));
     if ($optional_headers !== null)  {
        $params['http']['header'] = $optional_headers;
     }
      $ctx = stream_context_create($params);
     $fp = @fopen($url, 'rb', false,  $ctx);
     if (!$fp) {
        throw new Exception("Problem with $url,  $php_errormsg");
     }
     $response =  @stream_get_contents($fp);
     if ($response === false) {
        throw  new Exception("Problem reading data from $url, $php_errormsg");
      }
     return $response;
  }
</code></pre>
<p dir="auto">per inviare dati simulando un form in php..  ha  sempre funzionato a dovere ma ora ho la<br />
necesstità di inviare un file tramite lo stesso  metodo... ma sinceramente non ne cavo le gambe...</p>
<p dir="auto">dove lo passo il file? in $data? e come? ho provato  anche ad aggiungere 'enctype' =&gt; "multipart/form-data", fra i parametri ma  non è servito a molto..</p>
<p dir="auto">ho provato con la lib curl ma mi restituisce sempre lo stesso errore<br />
"failed creating formpost data"</p>
<p dir="auto">da notare il file mi arriva tramite un altro  form...</p>
<p dir="auto">Grazie in anticipo</p>
]]></description><link>https://dev.connect.gt/topic/77580/invio-file-tramite-post-in-php</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 13:26:36 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/77580.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 15 Jul 2008 10:54:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to invio file tramite POST in PHP on Tue, 15 Jul 2008 17:13:17 GMT]]></title><description><![CDATA[<p dir="auto">mi rispondo da solo...</p>
<p dir="auto">alla fine ho utilizzato la libcurl, gli errori che mi dava erano perchè<br />
non utilizzavo l'indirizzo fisico del file... e l '@davanti al nome file...</p>
<p dir="auto">grazie lo stesso..</p>
]]></description><link>https://dev.connect.gt/post/740722</link><guid isPermaLink="true">https://dev.connect.gt/post/740722</guid><dc:creator><![CDATA[arkant]]></dc:creator><pubDate>Tue, 15 Jul 2008 17:13:17 GMT</pubDate></item></channel></rss>