Questions tagged [stream-wrappers]

PHP stream wrappers allow you to implement your own protocol handlers and streams for use with all the other filesystem functions.

Filter by
Sorted by
Tagged with
-2 votes
1 answer
109 views

file_exists(): Unable to find the wrapper "private" - did you forget to enable it when you configured PHP? [closed]

I just installed a bare boned Drupal 10 locally. and Windows 10 with PHP 8.1.14 I set the private file path as follows: $settings['file_private_path'] = $app_root . '/../private'; Its path shows ...
Md. Shafiq Hossain's user avatar
1 vote
1 answer
79 views

How can I detect when a stream wrapper is uninstalled?

Does Drupal provide an "uninstall" hook to get notified when a Drupal Stream Wrapper is removed/uninstalled? Or, is there a way to prevent a custom Drupal stream wrapper from being removed/...
user1414202's user avatar
0 votes
0 answers
31 views

How move_upload_file calls to custom stream_wrappers class

In a node form, I upload a image to the server via ajax and before to send to the uri, I want to optimize the original image (not a image style). How is possible that from move_upload_file that is a ...
valerogarte's user avatar
0 votes
1 answer
255 views

Why does include() call PublicStream::stream_set_option()?

I am including a PHP file that in stored in the public:// directory. (Yes, I know that's generally a bad thing, but there are reasons, and this is done on a local development server.) I get this ...
joachim's user avatar
  • 846
0 votes
1 answer
238 views

Cannot instantiate interface DrupalStreamWrapperInterface

I am trying to replace drupal_realpath with realpath. What I did is $stream_wrapper = new DrupalStreamWrapperInterface(); $file_path = $stream_wrapper->realpath($img_path); But it gives me this ...
Moses Liao GZ's user avatar
0 votes
1 answer
90 views

Update programmatically value of field collection item

I want to update a field collection I have the following: function pdf_app_node_presave($node) { if (!$node->is_new) { global $base_url; if($node->type == 'article') { ...
user1619177's user avatar
0 votes
1 answer
27 views

Get programmatically value of sub field collection item of a field collection

I have a field collection field library and a sub field collection field book which has a field collection item field title. to get the first field collection I use a wrapper: $node_wrapper = ...
user1619177's user avatar
1 vote
1 answer
45 views

Storage API stream wrappers Traffic Usage

In my Drupal 7 Project I have configured Storage API stream wrappers in order to save all public and private files over ftp server. everything works well and files in public and private are copied ...
Mehrdad201's user avatar
  • 1,302
1 vote
2 answers
1k views

how to get the url to usefor a private path

if I have a file saved in private:://somefile.txt , what function can I use in drupal to give me the external URL to access that? I tried PrivateStream::getExternalUrl() but I get this error PHP ...
Diana's user avatar
  • 3,274
0 votes
1 answer
68 views

How to remove Storage API without data loss

I'm working on application based on Drupal 7.39 that use the Storage Api module version 7.x-1.8 with FTP container. I'm trying to achieve is to remove this module and use the normal flow to save ...
stuzzo's user avatar
  • 103
1 vote
1 answer
27 views

Stream_flush in not being called while using stream wrapper

I've created a stream wrapper foo:// and when I am using this wrapper and my file moved successfully but the flush_stream function is not called I don't why I also checked for the public:// stream ...
Akash Jain's user avatar
0 votes
0 answers
119 views

How to provide custom FileSystem?

I have StreamWrapper for Amazon S3 and I have noticed chmod is not working. I have looked into the \Drupal\Core\File\FileSystemInterface::chmod and it clearly states that contrib modules should ...
user avatar
2 votes
1 answer
1k views

DrupalTemporaryStreamWrapper::stream_open" call failed in file_unmanaged_save_data()

DrupalTemporaryStreamWrapper::stream_open call failed in file_unmanaged_save_data() I do not identify the problem. Could anyone help me?
Gabriela Lima's user avatar
-1 votes
2 answers
590 views

Programmatically attach an image to a node using Storage API to store image in the Database

I am building a site where I need to store encrypted images in the database. I'm using the module Storage API as it supports saving images to the database. I modified the db.inc file to just add an ...
Felix Eve's user avatar
  • 6,453
0 votes
0 answers
823 views

Custom Stream Wrapper

I have a file field in a content type. The files uploaded by this field should be handled by a custom php script. I think the best way to get this done is to write a custom stream wrapper. However, I ...
Елин Й.'s user avatar
  • 7,309
0 votes
1 answer
1k views

stream wrapper public /private not found Error

Configuration : WAMP on windows drupal 7 I have tried using $image = file_get_contents('E:\Team_Install\wamp\www\rootfolder\sites\all\modules\my_module\errorwinmobilesdk.jpg'); $file = ...
Dextar's user avatar
  • 51
1 vote
0 answers
150 views

Media module and StreamWrapper

I am using Media 7.x-1.3 on Drupal 7.21. I have created simple StreamWrapper to use with some other modules and it works great for them. It extends DrupalLocalStreamWrapper and overrides ...
Bnayal's user avatar
  • 73
3 votes
1 answer
3k views

Move File Field storage from public:// to another stream wrapper (like s3://)

I've been looking around for this a bit, and it seems like it would be relatively easy in Drupal 7, since D7 supports stream wrappers, and Fields are part of core... but I can't find any documentation....
geerlingguy's user avatar
  • 5,483
1 vote
1 answer
571 views

Using ftp wrapper in file_copy

Can I use php ftp wrappers using file_copy or file_move. like this: file_copy($file, 'ftp://user:[email protected]/file.flv', FILE_EXISTS_RENAME); Or is this limited to drupal default wrappers? And ...
Pouya Sanooei's user avatar
0 votes
2 answers
339 views

hooks call order and hooks dependency

I try to implement hook_menu() in a module and the code inside of this hook depends on another hook implemented in the same module Example: function mymodule_menu() { $streamwrapper = ...
Michael's user avatar
  • 366