Questions relating to files, both public and private including the file_managed database table

learn more… | top users | synonyms

0
votes
1answer
29 views

Save a Drupal managed file with cURL

I want to save a managed file from an external site. Previously, I've used this code: $managed = TRUE; // Whether or not to create a Drupal file record $image_file = system_retrieve_file($product['...
1
vote
1answer
23 views

Theming a webform file upload widget

I'm trying to replace the upload and remove buttons in a webform file upload widget with visual icons. I'm having trouble for a number of reasons but the most confusing is this: I don't see ...
1
vote
1answer
67 views

How to implement one click upload?

Drupal 8 supports multiple file upload, however the native interface requires three steps: Select one or more files Click Upload Click Save Ideally this could be simplified to a single step i.e. ...
3
votes
1answer
23 views

Drupal prevents file save on chunked upload because of php.ini max upload size

I'm encountering a tricky problem with my custom file widget (which extends the core file widget). It chunks files so that I don't have to raise upload_max_filesize and post_max_size in php.ini, and ...
1
vote
1answer
74 views

How are upload files stored?

I have a custom content entity. For this entity, I want add multiple uploaded files. After I set this up, I looked at the database and saw: file_managed => stores all files uploaded by a ...
0
votes
0answers
16 views

Images of some content types disappeared

I have something strange going on on one of my drupal installation. It seem's that for two content types all the images got unlinked from the existing entities. I can still see in the table ...
1
vote
1answer
19 views

How do you programmatically create a webform with a managed_file type?

I haven't been able to find a single example of how to create a webform with a managed_file type. The webform initially had the type 'file', but needs to be changed to accept multiple attachments. ...
0
votes
1answer
49 views

How can I get the URL to the public files directory?

I'm can get the path to the public files directory by using Filesystem::realpath: $path = $filesystem->realpath('public://'); But how can I get the URL of public://?
1
vote
0answers
26 views

Create module with managed file [closed]

I wanna create a page in my module with file managed upload, such as How make it? Show me source code please?
1
vote
0answers
40 views

Place CSS/JS aggregated files in a hierarchical directory structure

I use css and js aggregation for increase the speed of a drupal 7 website. Now, when I log in with user A, four news files (one css and one js) are added in the files website directory like that : ...
0
votes
0answers
26 views

user upload multiple pics for avatar approval

How to let user upload multiple pics for avatar approval in Drupal 7. 1) I used the avatar approval module, but I want to upload multiple images for different user?? 2) Different user can login ...
1
vote
0answers
42 views

Managed File element empty in $form_state on submit for anonymous user

I have a form built with Drupal 8 FAPI. It's a sophisticated "contact us" type thing which includes the ability to upload files. Among other things it includes several managed_file elements. The ...
0
votes
1answer
64 views

Drupal integration with external binary program to convert an image?

Using Drupal 8. On a cloud based site, I have a program for converting images into svgs that takes, at times, a few hours of run time. I can easily run the external binary program (configured to run ...
0
votes
0answers
19 views

Understanding Relationship Between `file_managed` and `file_usage` tables

I am trying to understand the Drupal database schema because I need to access the database via MySQL by another system and I do not have access to the original Drupal developer of the site nor do I ...
2
votes
2answers
39 views

Understanding `file_usage` table

I am trying to understand the Drupal database schema because I need to access the database via MySQL by another system and I do not have access to the original Drupal developer of the site nor do I ...
1
vote
1answer
19 views

Understanding `file_managed` table

I am trying to understand the Drupal database schema because I need to access the database via MySQL by another system and I do not have access to the original Drupal developer of the site nor do I ...
0
votes
1answer
27 views

Drupal Caching Files

After install and setup of my Drupal site, I've noticed that Drupal has placed a few dirs/files in my file directory like css/js. Is it safe to remove these files when I move my site? What other cache ...
1
vote
0answers
30 views

Using Views without Database Support

We build a Drupal 8 based content management system that uses a triple store as the main data back-end. So we don't have any content data in Database tables. All CRUD operations on entities stored ...
1
vote
3answers
379 views

Storing data / session for anonymous user

I am working on a shop, and for the cart, i need to store items before payment. $tempstore = \Drupal::service('user.private_tempstore')->get('boutique'); $tempstore->set('poids', $...
0
votes
1answer
43 views

Is hook_file_download the right hook for taking action when a private file is downloaded?

I'm trying to create a module that will fire send an event via google analytics' Measurement Protocol API when a file is downloaded. These files are all in the private file system outside of the ...
0
votes
1answer
77 views

managed file problem with anonymous users and two managed file fields

I have a form with two '#type' => 'managed_file' fields. Anonymous user selects a file on field 1, clicks the Upload. Ajax upload occurs and the browse widget is replaced by the filename uploaded ...
0
votes
1answer
32 views

What is the Drupal 7 version of FILE_STATUS_TEMPORARY?

My use case is that I want to set an uploaded file as FILE_STATUS_PERMANENT until I know it has been processed correctly by my custom module. Once that is done, I'm happy for Drupal to delete it. ...
0
votes
1answer
24 views

How to delete a managed folder and its contents programmatically via hook_uninstall?

My hook_update_N() implementation looks like this: $directory2 = 'public://folder_name'; file_prepare_directory($directory2, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); How can I remove "...
0
votes
0answers
29 views

Configuration Management services.yml

I'm trying to change the configuration storage from database to files during a clean install of a Drupal 8 site. I've read the documentation and several tutorials, books outlining what is needed. I ...
1
vote
0answers
120 views

Error saving custom field type module with “managed_file”

I have created a custom field type module (field plugin) containing four fields: title, description, address, image. Drupal version: 8.02 This is the schema structure inside FieldType php file: ...
0
votes
1answer
62 views

How to restore private file structure after major version update? [closed]

After a Drupal 6 to 7 update we are unable to use private image download, symptom is we cannot access private files via system/files, while public files can be loaded. Trying to download private file ...
0
votes
1answer
36 views

How to use file_save to store pictures into a folder on server?

what i want to perform (globally) is to import a csv file that contains data such as book_title, author, and the cover image of the books. The csv file is loaded, book_title and author are stored in ...
1
vote
0answers
23 views

is it possible to manipulate manage_file field on validation

Using the form api, is it possible to manipulate the managed_file field inside the validation function. For example if the fid of the field is 15, I want to change it to 10. It seems like it isn't ...
1
vote
0answers
32 views

( FAPI) Trouble Manipulating Managed Fields with Nested Field sets that can be added and removed dynamically

So my problem is this. I am trying to create a configuration form that allows you to control the front end of a page display. On the front page there are these regions, and each regions holds text and ...
1
vote
0answers
30 views

How to use Drag & Drop dnd:removeFile event?

I'm using Drag & Drop module to let users upload an image in their profile (I'm using a custom profile tpl). In that custom profile, I'm using in-place editable fields with AngularJS, so there ...
1
vote
1answer
30 views

Uploading and deleting unused images

I have a custom form with manage file input where users can upload their profile images. Upload looks like this: $acc = user_load($state['user_id'], TRUE); // upload profile image if ($state['...
0
votes
1answer
47 views

Managed file input is removing input values of appended input fields by ajax

I have a form with checkboxes that are calling ajax callback on checked. This ajax callback is appending another inputs: $form['expertise']['op-cat-'.$op_cat['id']]['op-'.$op['id']]['checked'] = ...
0
votes
1answer
96 views

create and save data to a file in the files folder from cron

I currently have some working example code where when a URL path i defined using hook_menu has been passed; My custom module will use file_get_path() to pull a txt file from another ftp server. It ...
1
vote
1answer
88 views

Get all managed file usage by id

Is there a way to get all the managed files used by a particular entity, i.e. a node or other module item? Looking in the file_usage table there is an id column and this is what I want to retrieve ...
0
votes
0answers
24 views

Drupal 7 large files from private file system not fully downloading

Files from private system are not fully downloading. When I download the file of 20MB or less it is downloaded perfectly. Files more than 20MB are not fully downloaded. For example after downloading ...
0
votes
0answers
7 views

Progrmmaticallly Add elements to file field

I am trying to add elements programmatically to a node's file field so it is rendered as it if it was native to the node. My first crack at this was to add it via theme_preprocess_node: function ...
0
votes
0answers
125 views

How to replace ajax callback of file upload in managed_file?

I have a text-area with some content inside. I have another form element that is for upload xls file. Now what I want to achieve is, when I click on upload button the xls file content should replace ...
1
vote
0answers
171 views

Drupal 8, The file used in the Image field may not be referenced

I am using managed file type to upload image in my custom form (Drupal-8). I am able to retrieve the given image while editing by using the below code $form['image_field'] = array( '#type' => '...
0
votes
1answer
29 views

How do I properly render a private file URI with l()?

If given a private file with a uri of private://Screenshot from 2015-12-07 15-52-42_0.png. How might I use l() to properly render the link? When rendered as follows I see https://server/drupal-...
0
votes
1answer
237 views

Default value of a 'managed file' field

I created an edit custom form (of a node) via a custom module. From this form, I have a "managed file" field (for one picture) and I set his default value to a fid; However, when my form is rendered, ...
0
votes
1answer
37 views

How to prepare directories in private file system?

I've configured private file system. Using it from UI works well. I want to generate dump site content via devel_generate with custom modifications. So I'm hooking into Node API for assigning sample ...
0
votes
1answer
236 views

Multiple upload image using managed_file

I'm trying to do a very simple thing (seems not that simple at all) in my custom form, to add multiple files using the managed_file form api. Like in the admin, select a file, upload, then a new input ...
1
vote
1answer
55 views

How can I programmatically remove the file from a managed_file form element?

I have a form where users upload images. When an image is submitted it is validated against various criteria. If the validation fails the user is returned to the form but the failed file is still ...
1
vote
1answer
51 views

Drush is always scanning the whole drupal directory?

Every time i run a drush command the command returns after 40s. (or more if time consuming operation like cache clean or so) After strace the command i realized that drush is scanning my whole drupal ...
0
votes
0answers
15 views

media browser only shows images

My media browser widgets only shows uploadet images. Not files of other types (.zip and similar). I need it to show uploaded files of all the following types - which the upload function already is ...
0
votes
0answers
18 views

Add random element to files in private so they can't be guessed

I want to add a random element to files in the /private/ directory so filenames cannot be guessed. In other words, when a file is uploaded by the admin I want the URL to download the file to be: /...
0
votes
1answer
79 views

How to change filename before it get saved without changing source URL using tamper plugin?

I've URL which is mapped to file field (image) via Feed Ex. I'm trying to change the filename before it's get saved using tamper plugins (e.g. concat or regex), however it is also changes the ...
0
votes
0answers
7 views

Resource manager table in the node edit does not show any resources

As the above screen shot shows, the table of resources of the current node edit is empty in-spite of the node has images and online videos. Is there common cause for this issue?
7
votes
1answer
714 views

Is it a problem when entity field storage info is not registered in the key_value table?

This is a Drupal 8 (beta 15) site, basic, few content types. On the status report page it says: Entity/field definitions Mismatch detected Mismatched entity and/or field definitions. After ...
1
vote
1answer
55 views

Moving / Migrating image files from another site into an existing Drupal 7 site

I'm currently doing a data migration from one Drupal 7 site to another Drupal 7 site. So far I exported the data from the old site into a CSV file and then have it get imported into the new site by ...