Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP - Large file upload error
    text
    copied!<p>I'm sending from a AIR desktop application an image along with some text as a Base64 encoded string. If the image size is around 100 KB the upload works but if its a bigger one ~220 KB I get an Error thrown back after some time. </p> <p>The error tells <strong><em>http://www.example.com/upload.php - Error opening URL</em></strong> but the url path is correct and can be found.</p> <p>What is wrong with my PHP?</p> <pre><code>&lt;?php $file = $_POST["thefile"]; $text_message = $_POST["themessage"]; $subject = $_POST["thesubject"]; $from = $_POST["thesender"]; $to = $_POST["theaddress"]; $attachment=uniqid(rand(), true) . '.png'; $headers="From: $from\r\n"; $headers.="Reply-to: $from\r\n"; $headers.="Return-Path: $from\r\n"; if (isset($_ENV["SERVER_NAME"])) $headers.="Message-Id: &lt;" . md5(uniqid(microtime())) . "@" . $_ENV["SERVER_NAME"] . "&gt;\r\n"; else $headers.="Message-Id: &lt;" . md5(uniqid(microtime())) . "@" . 'unknown' . "&gt;\r\n"; $headers.="Date: " . date("r") . "\r\n"; $headers.="X-Mailer: PHP\r\n"; if (isset($_ENV["REMOTE_ADDR"])) $headers.="X-SenderIP: " . $_ENV["REMOTE_ADDR"] . "\r\n"; else $headers.="X-SenderIP: " . 'unknown' . "\r\n"; if (isset($_ENV["SERVER_NAME"])) $headers.="X-WebSite: " . $_ENV["SERVER_NAME"] . "\r\n"; else $headers.="X-WebSite: " . 'unknown' . "\r\n"; $headers.="X-Script: SWF_Generator\r\n"; $bound_text=md5(uniqid(time())); $headers.="MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed; boundary=\"PHP-mixed-$bound_text\"\r\n"; $message="--PHP-mixed-$bound_text\r\n" ."Content-Type: text/html; charset=\"utf-8\"\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n" ."&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;" ."&lt;div style=\"font-family: Arial, Helvetica, sans-serif; font-size : 1.3em; color: #000000;width: 100%;text-align: left;\"&gt;$text_message&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;\r\n\r\n" ."--PHP-mixed-$bound_text\r\n" ."Content-Transfer-Encoding: base64\r\n" ."Content-Disposition: attachment; filename=\"$attachment\"\r\n" ."Content-Type: image/png; name=\"$attachment\"\r\n\r\n" .chunk_split($file) ."\r\n\r\n" ."--PHP-mixed-$bound_text--\r\n\r\n"; mail($to,$subject,$message,$headers); } ?&gt; </code></pre> <p>Server informations:</p> <pre> PHP Version 5.2.12-nmm2 System Debug Build: no Thread Safety: disabled Zend Memory Manager: enabled Registered PHP Streams: https, ftps, compress.zlib, compress.bzip2, php, file, data, http, ftp, zip Registered Stream Socket Transports: tcp, udp, unix, udg, ssl, sslv3, sslv2, tls Registered Stream Filters: zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload