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
-1 votes
0 answers
32 views

Ckeditor inline images won't be deleted from the file system after the node is deleted

I deleted the node, but I noticed that all the inline images which uploaded from CkEditor are still in the files/inline-images folder. Am I missing something, or won't these images be deleted at all?
lee's user avatar
  • 1
-2 votes
0 answers
60 views

The site does not display styles [closed]

The site does not display styles, shows only text, but mostly works. It complains that the files do not exist. But I checked, the files exist and there is read permission. What could be the reason
Kristof 01's user avatar
0 votes
1 answer
75 views

Can create directories but can't upload files

When I try to upload a file with a file field, Drupal creates a sites/default/files/2023-10 directory, but can't upload the file. I see this validation error in the UI: "File upload error. Could ...
arnoldbird's user avatar
  • 1,079
0 votes
0 answers
17 views

View File Uploads in Custom Module Admin Screen

I'd like to show a list of the files in a directory in my default/files directory. This will show's all files: /** * Helper function to retrieve and display a list of current uploads. */ protected ...
jasonflaherty's user avatar
0 votes
0 answers
94 views

Why is CloudFlare blocking file uploads?

I have a simple form where people raise IT helpdesk requests (oh, the irony...) and this creates a case in CiviCRM. It's an unsophisticted but cheap helpdesk system for the few requests we get. A ...
ChumKui's user avatar
  • 139
1 vote
0 answers
52 views

upgrade_d7_file_private failed

i am trying to migrate drupal 7 private files to drupal 9 Step 1 :- i have modified below file /opt/httpd/htdocs/staging/sitename/master/web/core/modules/file/src/Plugin/migrate/source/d7/File.php ...
Ali Rizvi's user avatar
1 vote
1 answer
23 views

Nginx: block access to extensionless LICENSE files

The Drupal Nginx recipe doesn't block access to extensionless files (such as files named "LICENSE"), and it also allows access to LICENSE.md and other files that can be checked to see what ...
mbomb007's user avatar
  • 514
-3 votes
2 answers
86 views

settings.php permission denied on Mac

During a project installation always fails to install correctly. Let me clarify this is how it should work: Drupal changes the chmod of settings.php to 777 and then applies changes for the drupal ...
Tazio's user avatar
  • 1
-2 votes
1 answer
110 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
0 votes
0 answers
50 views

Public Access to Private Files

I have a content type that allows one or more file attachments and these are set as Private so that access to them can be controlled. A small percentage of these files I also want to be publicly ...
Delford Chaffin's user avatar
0 votes
0 answers
20 views

MSSQL - How to get a list of documents from a node that is using a space and a view?

I have a list of documents that are associated with a node of type space. The space has a page with a view and filter to list documents only related to that node. I'm trying to query the database to ...
Charlie Boy's user avatar
0 votes
1 answer
33 views

Why should a Drupal copy be extracted in the web directory?

I am trying to create a multi-site using Set up a multisite, but I do not understand the reason for step 1.2. Why should a Drupal copy be extracted in the web directory? There doesn't seem to be ...
cossinner's user avatar
0 votes
1 answer
166 views

GET /sites/default/files/js/js_xxxxxx.js - No such file or directory

This is my first post, I just started to learn and use Drupal, and I wish to install a fresh new site on my local Windows machine using composer. The issue is that it has a file not found error from ...
Jeffrey1862's user avatar
0 votes
1 answer
129 views

Webform File Attachments Uploaded But Not Linked to Submission

I have Webform 6.1.5 running in a D9.5 website, that has lots of other contrib modules. Using the Webform Attachments sub-module I have some simple forms that require files to be attached to the ...
Rob Carr's user avatar
0 votes
0 answers
83 views

how to add the "alt" attribute to a "managed_file" type image field

I have a custom form in drupal 9 where I am creating a managed_file type field to upload an image: $form['footer']['logo'] = array( '#title' => 'Logo', '#type' => 'managed_file', '#...
Juan Carlos Osorio's user avatar
0 votes
0 answers
27 views

Why is this hook implementation not working? [duplicate]

I am new to custom modules and hooks and i am trying to connect to a sharepoint site i created to upload pictures of a content i have into sharepoint instead of drupal's file system. My issue is not ...
Rayan Frem's user avatar
0 votes
0 answers
97 views

Temporary file issue when creating a file from an external script

I would like to create a file and write some data to it using a PHP CLI script. The script will bootstrap Drupal and then use either the file_system or file.repository services to perform the task. ...
H M's user avatar
  • 21
1 vote
0 answers
21 views

How to output file upload date (of a file field) in a JSON-view?

I have rest_export view to generate json output of nodes. I'm trying to output a the upload date of files in a multivalue filefield, but can't find a solution. I tried to use the "rewrite results&...
Chris's user avatar
  • 11
-2 votes
1 answer
76 views

Deleting a File from Website [closed]

I host my municipality's website (lionsbay.ca) through Drupal. On this website, residents can find council minutes and agendas. Upon request of a resident, she would like her information removed from ...
eando's user avatar
  • 9
0 votes
2 answers
63 views

How to remove an uploaded file with JSON:API?

I have an image field on the User entity that saves to the private filesystem. The field is limited to one image. I can POST an image file to the field using JSON:API in accordance with this change ...
Patrick Kenny's user avatar
1 vote
0 answers
107 views

Running a hook after node save, or another way to get the file name attached to a node

We've a D9 site with a custom module which generates and saves CSS code. It takes the name of the file attached to a node, and generates CSS to set it as the node's background. Initially, I tried ...
Bytech's user avatar
  • 111
0 votes
0 answers
24 views

Trouble upgrading 7.90 to 7.91 [duplicate]

I'm trying to keep a D7 site up to date, it's currently running 7.90. I tried to upgrade to 7.95, but I ran into trouble, and eventually figured out that it's the 7.90->7.91 transition that's ...
Ken Williams's user avatar
0 votes
0 answers
29 views

How would I access the pdf generated by Webform's Attachment PDF in a custom Webform Handler?

I have created a custom Webform Handler that takes the files uploaded by the user on a Webform and uploads them to the third-party file management system Box via Box's API. I want to also upload the ...
user110123's user avatar
0 votes
1 answer
239 views

How to upload .webp to Image field?

https://www.drupal.org/project/imagewebp lets you upload a regular jpg/png which converts it into webp, but how to upload already a file that is in webp? Adding it as one of allowed extensions in the ...
user3108268's user avatar
0 votes
2 answers
132 views

Modern File Manager for upload and organize documents?

Being new to Drupal, I still struggle with its File-Management. I have the following use-case: Authenticated Users from group 'comitee' can upload files (jpg, png, pdf and docx) to the Server, rename ...
mullzk's user avatar
  • 65
1 vote
0 answers
58 views

fclose only creates file at script end when running drush command [closed]

I'm really struggling with Drupal php memory/file/cache management. I've tried a lot of different ways to avoid memory errors (php 8.1) when writing a multi-megabyte file out. My observation is even ...
Scott's user avatar
  • 31
1 vote
1 answer
303 views

How can I modify/edit/change the media video controls?

I was wondering how could I modify the controls from a media video. In my particular case, I want to remove the "Download" button from the controls, see:
Alejandro's user avatar
0 votes
0 answers
286 views

How can I send a multipart/post-data POST request via a resource controller?

By trying to create a custom REST API through a resource controller via a custom module in Drupal 9, I would like to be able to send my data from a multipart/form-data Content-Type in order to pass ...
Quentin's user avatar
  • 101
2 votes
0 answers
522 views

Allow users to upload heic images and auto-convert to jpg

It seems that heic images are increasingly popular way to store images (the default image format since ios 11, but browsers do not support them. Site visitors may attempt to upload an heic image from ...
greggles's user avatar
  • 5,242
1 vote
1 answer
42 views

Storing PDF Subject Data in Media Entities

I have pdf documents that I need to create as entities on our website. The pdfs were created with metadata, such as title and subject, that we want to have available in Drupal. I am trying to save the ...
GradoniusTheWise's user avatar
0 votes
1 answer
55 views

How do I insert migrated file info into a file field?

Successfully migrated public and private files to D9 system using core d7_file and d7_file_private migrations. Now trying to migrate the file info into file fields (entity_reference_revisions:...
SomebodySysop's user avatar
0 votes
1 answer
125 views

How can I prevent renaming of files uploaded with JSON:API for a specific field/filename?

I created a Profile photo image field on the user entity. This is for a decoupled site where users upload files with JSON:API. The file field is configured like this: File directory: profile-pics/[...
Patrick Kenny's user avatar
0 votes
1 answer
122 views

How do I retrieve the tokenised path for the Files Directory setting configured via the fields settings? [closed]

I'm using this code to retrieve a remote file, during the process of creating a new a media entity. $url = 'https://example.com/example.jpg'; $image = system_retrieve_file($url, NULL, TRUE); $...
gMaximus's user avatar
2 votes
2 answers
657 views

Redirect doesn't work for .pdf file

Is it possible to create a redirect for documents using the Redirect module? I can't seem to find a solid answer. Basically I'm just trying to create a redirect from https://www.example.com/default/...
divspan's user avatar
  • 21
-2 votes
1 answer
52 views

Clicking links to uploaded files shows bytecode

This issue just started occurring on our app. We allow users to upload files in our forms and we create links for those files like so; $f = \Drupal::entityTypeManager()->getStorage('file')->load(...
Christian's user avatar
  • 762
1 vote
1 answer
379 views

Form to upload and replace unmanaged file

I want to make a form where a user can upload a file that will be saved in a predefined path in the private filesystem, replacing whatever was there before. E.g. the destination file path could be '...
donquixote's user avatar
  • 3,622
0 votes
0 answers
64 views

I am having trouble uploading an image in Gutenberg, can I upload it otherwise to the media library?

I am having trouble uploading an image in Gutenberg (there is "infinite loading", without error, when I try to upload and eventually no image gets uploaded to the media library). Can I ...
beltazzar's user avatar
1 vote
0 answers
151 views

How can I access the file-link.html.twig template?

I'm trying to access the functionality of the file-link.html.twig template that comes with the classy theme so that I can have the file-type icons automatically appear next to the file links. I've ...
bigmike7801's user avatar
0 votes
1 answer
54 views

Can a template file write, copy, or rename files? [closed]

Can code put in a template file write, copy, rename files, or read files that aren't template files?
0 votes
1 answer
63 views

Ajax validation of file upload in Commerce Product with product attributes

I am building a shop with Drupal Commerce right now. I have a product that uses an Order item type, which supports a file upload. The same product also has some product attributes that load the ...
what ever's user avatar
0 votes
1 answer
124 views

managed_file not initialised after form ajax

I'm having issues with a managed_form field not beeing initialised after it is introduced via a ajaxcallback in a custom checkout Pane: /** * Provides a custom message pane. * * @...
Andreas's user avatar
  • 372
0 votes
0 answers
28 views

How to prevent numbering (_0, _1) of file uploads? [duplicate]

Is there a way in Drupal 7 to prevent numbering (_0, _1) of file uploads with the same name? How to tell Drupal to replace the previous file? Maybe there is already a ready-made module? Or does anyone ...
anthony3d's user avatar
2 votes
1 answer
780 views

Get the real filename of file entity

I'd like to get the real filename of a file entity. My code is like this $filenames = []; foreach ($entity->$field->referencedEntities() as $image) { // Filename. $media = ...
Daniel Harper's user avatar
0 votes
1 answer
89 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 $...
tomurillo's user avatar
0 votes
0 answers
227 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 ...
Daniel Harper's user avatar
1 vote
0 answers
352 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 ...
Vitaliy K's user avatar
  • 109
0 votes
1 answer
3k 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 ...
Giuseppe's user avatar
  • 907
0 votes
0 answers
443 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 ...
Bill's user avatar
  • 1
0 votes
1 answer
2k 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/...
Kamal Oberoi's user avatar
2 votes
1 answer
245 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 ...
Morten's user avatar
  • 101

1
2 3 4 5
50