Recommended WordPress Theme

Failed to open stream: HTTP wrapper does not support writeable connections

6 days ago by Tamas

A couple of recommendations if you are building an image or file upload script with php and getting the following error.

"Failed to open stream: HTTP wrapper does not support writable connections"

First of all check the directory’s permissions and make sure you have the correct read-write permissions enabled on the directory.

If that doesn’t work, you might need to adjust the script and the way you are trying to access the upload folder.

For example, instead of this:

$post_image = $_FILES['post_image']['name'];
$post_image_temp = $_FILES['post_image']['tmp_name'];
move_uploaded_file($post_image_temp, "$post_image");

use server path. You can use the $_SERVER superglobal to get the document root directory like this:

$post_image = $_FILES['post_image']['name'];
$post_image_temp = $_FILES['post_image']['tmp_name'];
move_uploaded_file($post_image_temp, $_SERVER['DOCUMENT_ROOT'] . "/phpscript_or_site_name/assets/images/uploads/$post_image");





Subscribe to our newsletter!

Get the latest tutorials and articles right into your inbox!

0 comment


Your email address will not be published. Required fields are marked *