Questions tagged [files]
Use it to generally reference to those files used on websites which could be video, images, pdfs, etc.
2,485
questions
0
votes
1
answer
16
views
Custom form module with file upload returns null value for file after submit
For a job interviewe task, I have to make a drupal module from scratch without the use of external modules. So far it's going okay, for someone who's new with Drupal, but I'm stuck at this point and I ...
0
votes
0
answers
28
views
Webforms file upload automatic saving to /tmp (_sid_) causes vulnerability?
We've recently encountered a potential security issue with Webforms file upload field automatically saving any selected file to /tmp (/_sid_), even when the filesystem is private.
The current file ...
2
votes
1
answer
40
views
How to validate file uploaded to JSON:API based on the associated field?
I have a custom entity called contact_upload.
The custom entity has an entity reference field called fid, referencing file entities.
I am uploading files to this entity using jsonapi (using the ...
0
votes
0
answers
44
views
Add field file for upload inside a custom field
Drupal 9.5.11
I have a Timeline component that uses three fields:
field_title
field_body
field_timeline
Field_timeline is a custom field with:
TimelineDefaultFormatter.php
Timeline.php
...
0
votes
0
answers
8
views
How can files referenced in old node body revisions be excluded from Search API (SAPI) index?
My nodes have (links to) files inserted in the body text (using CKEditor).
There are multiple revisions of these nodes with changes to those files/links as well, sometimes files were removed, ...
0
votes
1
answer
27
views
Responsive Image field
I re-created a website previously written with Drupal 8.9.20 using Drupal 10.3.0. The theme I used is Parallax Theme 8.x-1.8 in Drupal 8 and Parallax Theme 3.0.1 in Drupal 10. In both versions of the ...
1
vote
1
answer
86
views
Avoid serving unused core files
I analyzed my Drupal website using Chrome's Code Coverage feature. I noticed that there are a lot of core files loaded (CSS and JS) which aren't used at all, for example:
Resource
Unused
/core/...
0
votes
0
answers
35
views
PDF in Private files cannot display inside the browser
I have drupal 9 webform and files element (private file system), if i access the file its always downloaded.
I've add header Content-Disposition: Inline in the nginx conf
# Handle PDFs to display ...
0
votes
0
answers
51
views
Using Webform to upload a media file?
I have the Media Module enabled and have a Media type defined called Approved Image. This is identical to the standard Image but has just one addtional boolean field called 'authorised'.
I can create ...
0
votes
1
answer
30
views
Cannot find file input
Im new here and currently building my first Drupal website. Im having trouble creating a webform because i cant find the file input option to include in the form. When i googled it, i found that the ...
0
votes
0
answers
62
views
File upload becomes empty after form submit for anonymous users
I've build a form in Drupal 9 with Form API.
When logged in as admin, all is working fine.
Selecting a file as anonymous works, and the validations are checked.
But when I submit the form, the ...
0
votes
0
answers
27
views
Backup Migrate Error: "Could not create a temporary file to write to.", but /tmp folder is already 777 on Ubuntu server
I'm trying to manually backup using backup and migrate module on Drupal 9.4, but I keep getting this error:
Could not create a temporary file to write to.
I checked with file system page and it says ...
0
votes
1
answer
36
views
Creating a file type of epub in commerce
I want to give customers the option of downloading an epub file or a pdf in Drupal Commerce 2. Drupal 10.
In admin/structure/media types/document/manage fields I added the document file type epub.
...
0
votes
0
answers
138
views
Using a symbolic link under files
In our Drupal installation, I need a file repository that survives deploys and gets some special treatments, so I thought I could use a symbolic link to a NAS mount point below web/sites/default/files....
0
votes
1
answer
274
views
Is there an API to read file content?
Most references seem to read files using PHP functions like file_get_contents(), fgets(), fread(), or readfile().
Is there is any Drupal API that allows to read uploaded files independent of ...
0
votes
0
answers
143
views
Webserver issues, classes not found, failing to unlink cached files
When clearing caches via Drush cr I get
Failed to unlink file 'assets://css/css_4PAeT4dMiadmmD9t_xS9tkg36id2j4imvFUmocQZbdM.css'
which usually means no rights to delete but my system has all admin ...
0
votes
0
answers
42
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 ...
0
votes
0
answers
30
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 ...
0
votes
0
answers
86
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 ...
0
votes
0
answers
16
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.
...
-1
votes
3
answers
179
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 ...
0
votes
0
answers
152
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 ...
1
vote
2
answers
296
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 ...
0
votes
0
answers
22
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 ...
1
vote
0
answers
408
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 ...
1
vote
0
answers
136
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
...
1
vote
1
answer
46
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 ...
-3
votes
2
answers
183
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 ...
-2
votes
1
answer
416
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 ...
0
votes
0
answers
86
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 ...
0
votes
1
answer
37
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 ...
1
vote
1
answer
494
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 ...
0
votes
1
answer
517
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 ...
0
votes
0
answers
170
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',
'#...
0
votes
0
answers
28
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 ...
0
votes
0
answers
222
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.
...
1
vote
0
answers
27
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&...
-2
votes
1
answer
199
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 ...
0
votes
2
answers
144
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 ...
1
vote
0
answers
251
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 ...
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 ...
0
votes
1
answer
496
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 ...
0
votes
2
answers
533
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 ...
1
vote
0
answers
69
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 ...
1
vote
1
answer
573
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:
0
votes
0
answers
431
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 ...
3
votes
0
answers
867
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 ...
1
vote
1
answer
56
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 ...
1
vote
1
answer
88
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:...
0
votes
1
answer
170
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/[...