Failed to Open Stream: Http Wrapper Does Not Support Writeable Connections

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

Instead of doing file_put_contents(***WebSiteURL***...) you need to use the server path to /cache/lang/file.php (e.g. /home/content/site/folders/filename.php).

You cannot open a file over HTTP and expect it to be written. Instead you need to open it using the local path.

Codeigniter - failed to open stream: HTTP wrapper does not support writeable connections

File Upload function does not support HTTP & https based file path. also if you are used linux based os like ubuntu or mac to give the folder permission is 777 of all folder for ex. assets , image and product those three folder need read & write permission 777

public function do_upload()
{
if(isset($_FILES['picture']))
{
$dossier ='./assets/image/product/'; //based folder path if is inside public so u can use $dossier = './public/assets/image/product/';
$fichier = basename($_FILES['picture']['name']);
if(move_uploaded_file($_FILES['picture']['tmp_name'], $dossier . $fichier)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné...
{
echo 'Upload effectué avec succès !';
}
else //Sinon (la fonction renvoie FALSE).
{
echo 'Echec de l\'upload !';
}
}
}

Can't fix error failed to open stream: HTTP wrapper does not support writeable connections

Instead of doing

$target_dir = "http://myDomainName.com/SchoolStore/Images/";
you need to use the server path to

/SchoolStore/Images/ (e.g. /home/content/proj/SchoolStore/Images/).

You cannot open a file via HTTP. Instead you need to open it using the local path.

Failed to open stream: HTTP wrapper does not support writeable

You are getting the error because you are trying to open a file over HTTP and expect it to be written on a local path. Remove "base_url()" and replace it with a local path.

As you are looking to store the file under the "public" directory, you can update the code to -

if ($file->isValid() && ! $file->hasMoved()) {
$rectocni = $file->getRandomName();
$file->move(ROOTPATH.'public', $rectocni);
}

"ROOTPATH" is a constant that has the path to the project root directory.

It is not good practice to store the uploaded file in the "public" directory, instead, look to place it under a sub directory under "writable".

Getting error with move_uploaded_file HTTP wrapper does not support writeable connections

Use this:

$uploadfile = $_SERVER['DOCUMENT_ROOT'] . '/sites/bestinfo/images/news/CodeCogsEqn.gif';


Related Topics



Leave a reply



Submit