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

Bug can occur when using the following code to refer to your file system, for example to save a file to your file system:

$path_to_files = file_create_url("public://");

Instead, use this:

$path_to_files = \Drupal::service('file_system')->realpath();

 

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!