Questions tagged [files]

Use it to generally reference to those files used on websites which could be video, images, pdfs, etc.

Filter by
Sorted by
Tagged with
0 votes
1 answer
27 views

Multistep Ajax form with ManagedFile: current step array dissapears from $form upon file upload callback

I have a custom multi-step Ajax form. On the second step, I have defined a managed_file field where users can upload several attachments: public function buildForm(array $form, FormStateInterface $...
user avatar
0 votes
0 answers
21 views

How to offer the GPX file for download, on the node?

I installed the "Geolocation Field" module on Drupal 9. In my content type, I created a "Geolocation GPX File" field to load a GPX file. I loaded a GPX file in the node field : ...
user avatar
  • 1
0 votes
0 answers
13 views

Custom #upload_validators not firing

I have the following code but the custom validator is not being fired when I add a file to the file field. If the file isn't a csv then I get an error message but if I upload a csv then the second ...
user avatar
1 vote
0 answers
38 views

Theme suggestions file-video.html.twig

I have a block with the media field video bundle (drupal 9) and it renders the video through the file-video.html.twig. I have copied template to my custom theme from core. What do i need is to ...
user avatar
0 votes
1 answer
105 views

How upload a file\image via json api?

I'm trying to upload a file or image on a D9 site via json api. The test is namely to upload the user picture on the user entity. I've been following the documentation or read questions about, but I ...
user avatar
  • 490
0 votes
0 answers
33 views

Webform upload files issue

I have setup our site to allow files to be uploaded and attached to the submission of the webform. I have the private directory setup with the .htaccess file. That part seems to be ok because when I ...
user avatar
  • 1
-1 votes
1 answer
68 views

How do I debug Drupal\Component\PhpStorage\FileStorage::createDirectory()?

On my site, I am getting this warning. Alert: User warning: mkdir(): Permission Denied in Drupal\Component\PhpStorage\FileStorage->createDirectory() (line 123 of core/lib/Drupal/Component/...
user avatar
1 vote
0 answers
64 views

Drush can't write to /tmp

Drush does not seem to be able to move files to the tmp folder on my local machine. Changing the tmp folder location to for instance "sites/default/files" works, but I would like to know why ...
user avatar
  • 91
1 vote
1 answer
36 views

Key based access control for private files

I'm building a site that provides paid video content, for embedding in customer's own sites. I'm successfully controlling access to the nodes that contain the video content based on purchasable user ...
user avatar
  • 195
1 vote
1 answer
35 views

Compress file with ArchiveInterface without file paths

I'm trying to create an archive of log files to be downloadable in a form making a custom module in Drupal 9. In the form, the user can change the format of the archive, as per image: Here below my ...
user avatar
  • 93
0 votes
0 answers
24 views

how to get file id

I have this webform submission hook and i want to add a file to it when its submitted. I know how to alter the webform submission but now i have an issue that i want to load a file but i don't know ...
user avatar
0 votes
1 answer
19 views

Actual file permisions

With Drupal 8/9 I want to: Have a private file folder Upload files to it (ideally by whatever method but media type will do) Allow only authenticated users (ideally set by role) to view the file (...
user avatar
  • 1,125
0 votes
1 answer
50 views

Writing to the temporary directory randomly stops working [closed]

In one of the websites on production, when Drupal writes on the temporary directory, it randomly stops working with the following error, even though the permissions are set correctly, and there is ...
user avatar
0 votes
0 answers
24 views

Unable to delete image file on imce

Good day! I would like to ask on how to solve this issue, I can't delete an image file on imce though I already deleted the node revision even the node page still I can't delete the file. It always ...
user avatar
0 votes
0 answers
39 views

Migration does not pick up files

Please forgive me for not going the canonical path with either Drush or Composer. I tried, but could not find documentation to get me started. I'm coming from a Debian installation of Drupal 7 that ...
user avatar
  • 3
0 votes
0 answers
22 views

save file in file_usage of custom field

I have created a custom field for advice it has four subfields : title, body, url, image. Everything works perfectly except the image is deleted after a certain period of time because it was not added ...
user avatar
2 votes
0 answers
67 views

I cannot access PDF files uploaded in the private directory

PDF files uploaded to the private directory cannot be viewed and returns a 404 error. This also happens to the user with the Administrator role. Other file types can be viewed with no issue. This ...
user avatar
0 votes
2 answers
15 views

Files with 644 permissions and owner apache:apache are still failing Security Review module

I am using Drupal 7 and just installed Security Review. According to this page, the files should be 644. I tried that but I am still failing Security Review (I'm getting hundreds of files under the ...
user avatar
  • 263
0 votes
1 answer
31 views

Private File Permissions Not Working for a Single file - Can't Identify where to find error

I have the following set up: Private file field configured on content type Access control configured with referenced user having permission to view file If user is referenced on the node, they can ...
user avatar
  • 273
0 votes
0 answers
19 views

What could cause some managed private files to not be on the server even though Drupal shows the file is being used?

We have a custom Drupal 9 form with a managed file field that allows users to upload a (private) file to the Drupal Commerce order. This works well except that about 5-10% of the time the file is not ...
user avatar
1 vote
1 answer
49 views

Override the default private file access

In the site I am developing, the private files directory is outside the document root. I have a content type (Chapter) with a file field that stores its files in the private files directory. When a ...
user avatar
0 votes
1 answer
91 views

How do i save a base64 decoded image to file_managed?

I'm trying to save my image to Drupal's file_managed table. However, my image is coming from base64 decode: $filename = "sign-".$user->id(); // returns "sign-1234" $image_raw =...
user avatar
0 votes
1 answer
85 views

How can I overwrite existing file and keep same filename when uploading new

I have content type 'Document' and added the 'Upload document' field with type 'File' I want to replace file and update the node. I'm using below code function custom_file_upload_form_alter(&$form,...
user avatar
1 vote
0 answers
19 views

Permission denied on some private files, even though access is permitted

Drupal 9.3 We have a site that allows private file uploads. We get intermittent files that cannot be viewed/downloaded, even with the "User 1" account. There is no difference between a ...
user avatar
0 votes
0 answers
33 views

Document File Field Ajax Error

I am having trouble with file uploads for anonymous users. I get a non-descript ajax error. It works fine when signed in as an admin user. Any ideas on how to troubleshoot the problem? I've made ...
user avatar
  • 1
0 votes
0 answers
32 views

How do you add a PDF attachment to a page?

Complete Drupal Newbie here. I have created a basic Drupal 9 site so as to teach myself Drupal. I have added some Basic pages, and put them onto the menu. I can edit the text in each page just fine,...
user avatar
0 votes
1 answer
86 views

Link to images in form view creates wrong url

I noticed this after drupal 9 update, but I've tried to find the exact moment when it was broken and I couldn't find it. I use S3 and cloudfront for images so maybe the problem is related with that ...
user avatar
  • 83
0 votes
0 answers
32 views

Image compression problem

I keep on running into an issue with image compression on Drupal. I have a set of good quality, clear images, that I'm resizing down to 100px by 100px in CSS. When I resize, the quality worsens and ...
user avatar
  • 11
0 votes
0 answers
50 views

How to compare the original file and replacing file to upload prior to the action of physical uploading?

Exploiting the file_save_upload functions options, i would like to give a different treatment to the file on media replace. https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/...
user avatar
  • 2,775
1 vote
1 answer
41 views

How to migrate files from outside Drupal, with files already where they need to be, creating file entities

I'm doing a migration from a non-Drupal site--so far, for test purposes. I have all the data in CSV files. Since I'm brand new to migrating into Drupal 9 from outside Drupal, I'm learning this in ...
user avatar
  • 117
1 vote
0 answers
75 views

Restrict a Media field to allow selecting only a certain file extension in an existing Media Type

Is there a way to restrict a Media field using an existing Media Type (File) in a Content Type to permit only a certain file extension in that instance? In particular, I need a subset of the permitted ...
user avatar
  • 198
0 votes
0 answers
34 views

How to set an encrypted file field's value programmatically

I'm trying to set an encrypted file field's value programmatically. I'm using Encrypted Files module. I have successfully configured a file field, and it works for the contents created using the node ...
user avatar
  • 7,185
1 vote
1 answer
48 views

Is it possible to allow anonymous users to view a temporary managed file via hook_file_download()?

I am creating a live image preview system for customizable products that needs to send a user's temporary file to a remote server. I have a token-based system to protect the file but the problem seems ...
user avatar
0 votes
0 answers
55 views

Why are the images referenced using a relative path instead of an absolute path?

I have installed my Drupal site on my localhost under a path like /websites/mysite/drupal. Most files get loaded correctly, such as those at /websites/mysite/drupal/sites/default/files. For some ...
user avatar
  • 133
2 votes
1 answer
82 views

get the file URI of an ImageItem

How can I get the file URI of a Drupal\image\Plugin\Field\FieldType\ImageItem instance? I get the field value with $node_entity->get('field_image')[0] but I don't know how to get the file URI.
user avatar
  • 43
1 vote
1 answer
24 views

Reference private file?

I'm making migration plugin which I'm using in first migration and it is creating private file like this: if ($final_destination) { // Create a file entity. $file = File::create([ 'uri' => $...
user avatar
  • 375
0 votes
1 answer
52 views

Creating file from s3fs (S3 bucket) breaks migration

I have s3fs module installed and configured, so when I upload some file it goes to S3 bucket. Then I'm making processing plugin which should copy file from another S3 bucket to Drupal's bucket and ...
user avatar
  • 375
0 votes
1 answer
16 views

How to make the private image accessible with image style?

I have a private image with this URL. http://mystite.com/system/files/images/IMG_0371_24.jpg/IMG_0371_24.jpg An image style is created for the above image on location http://mysite.com/system/files/...
user avatar
  • 2,697
0 votes
1 answer
70 views

Unable to upload files through RESTful services

I am trying to upload pdf files to webform submission using REST API. Since the Core File Upload functionality did not seem applicable for webform submission, I applied the patch from webform_rest ...
user avatar
0 votes
0 answers
36 views

Getting 403 randomly on files

I have a react-native app that authenticates with Drupal via oAuth2 (simple_oauth, openidconnect) and do not use cookies. I use my access token for all rest calls, images and other files. Very ...
user avatar
0 votes
1 answer
39 views

How to edit file 'description' label and help text

I want to edit the file upload description label and the help sentence underneath it: I tried the below code: function mymodule_field_widget_form_alter(&$element, FormStateInterface &$...
user avatar
  • 33
0 votes
2 answers
40 views

redirect an old url that no longer exists related to a file to a new one

I have 2 urls: www.example.com/somefile.pdf www.example.com/somefileNew.pdf the first one no longer exists, i want to redirect this url to the new one. I tried to use the redirect module to no avail ...
user avatar
0 votes
0 answers
27 views

How can we directly display/download attached document on Media path

I am trying to directly display/download the attached file when the Media link is reached. Main reason behind this is to avoid providing file path directly. For example: if a user is visiting www....
user avatar
  • 115
1 vote
1 answer
177 views

Add custom font to mpdf while using PDF using mPDF module

I made a custom module to create a PDF from a views page. This module depends on PDF using mPDF. I'm now trying to add a custom Google font. This should be the default font when generating a pdf. But ...
user avatar
  • 892
0 votes
1 answer
44 views

How can the custom files copied by code to the private directory be accessible through URL for authenticated users?

In my project, I am using headless Drupal with .Net on the front end. I have to use private and encrypted file systems for the project requirements. The files which I am uploading through Drupal ...
user avatar
0 votes
2 answers
76 views

How can i render a file using a formatter programmatically in a controller?

I'm trying to create a controller to render a swagger documentation using the module swagger_ui_formatter that provide a formatter to the file field that render swagger files (yml, yaml, json) using ...
user avatar
1 vote
0 answers
71 views

Files migration from local dev site

I'm migrating from Drupal 7 to Drupal 9 and am having an issue with my source files getting found with the upgrade_d7_file migration. My public files directory for my source site is not 'sites/default/...
user avatar
0 votes
0 answers
20 views

Getting different Public path for admin and anonymous users

My site was built using Lightning Drupal distribution. I had my public path as /sites/default/files. I did change the configuration path to /sites/<my_domain>/files in the middle of the project. ...
user avatar
  • 1
0 votes
1 answer
49 views

Ckeditor inline images path

I am running a Drupal 9 site and I expect my users to upload a lot of files with the ckeditor functionality. All of those files will be stored in a single folder. I heard that this will cause ...
user avatar
2 votes
0 answers
67 views

S3FS IMCE File upload issue for old files in Upgraded site

I have a question on IMCE File upload. Hope someone might have come across the similar issue. Installed modules: https://www.drupal.org/project/s3fs https://www.drupal.org/project/imce We have added ...
user avatar

1
2 3 4 5
49