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
0 answers
31 views

Entity upload endpoint (POST) API security

Although Drupal provides default security features, I still have a doubt related to the security of uploading a file using the file entity upload API URL. If I have set the allowed file extension and ...
Tejas's user avatar
  • 1
0 votes
0 answers
15 views

Specifying product image upload location for each image

I have been searching for how to specify the image upload location (folder/directory) for each commerce product, to keep the file system organized. I have been having trouble finding a clear ...
corE's user avatar
  • 1
0 votes
0 answers
19 views

File migration issues

Well - where to start? I'm trying to migrate a medium-sized Drupal 7 site to Drupal 10. I am just going to concentrate on the migrations of files. I'm confused by a few things. One is that I am by ...
Steve Hanson's user avatar
0 votes
0 answers
9 views

How to create view of files upladed to webform with appropriate webform fields data?

In my webform user can attach multiple files. What I am struggling with is creating a view of files (so line per file, not line per webform submission) with webform files and appropriate webform data. ...
petiar's user avatar
  • 366
-1 votes
1 answer
69 views

.htaccess file under sites/default/files/ stops css from loading

I'm working on a new installation of Drupal 10.2 and I noticed there's an .htaccess file in the files folder. This file is created automatically by Drupal. When I try to delete it, it gets created ...
Yusef A's user avatar
0 votes
0 answers
39 views

File Does Not Exist - Drupal Migrate module

I am using the Migrate Drupal UI module to upgrade a simple Drupal 7 site to Drupal 9 using the web browser upgrade form. I am having an issue where when the upgrade runs it says the files do not ...
Madison Beatty's user avatar
0 votes
1 answer
117 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,173
0 votes
0 answers
18 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
1 vote
0 answers
193 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
  • 169
1 vote
0 answers
84 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
29 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
112 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
188 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
63 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
21 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
35 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
249 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
212 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
118 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
122 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
24 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
107 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
83 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
162 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
36 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
294 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
185 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
61 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
379 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
335 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
603 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
46 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
1 vote
1 answer
68 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
138 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
142 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
766 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
58 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
  • 782
1 vote
1 answer
465 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,632
0 votes
0 answers
73 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
160 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
56 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
64 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
133 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
  • 392
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
887 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
94 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
252 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
393 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
  • 129

1
2 3 4 5
50