Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
13 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 ...
ChumKui's user avatar
  • 179
0 votes
2 answers
25 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 ...
drupalnewbie99's user avatar
0 votes
0 answers
41 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 ...
user3086053's user avatar
0 votes
0 answers
20 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 ...
Patoshi パトシ's user avatar
0 votes
1 answer
26 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. ...
Bessaston's user avatar
0 votes
0 answers
52 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....
Francesco Marchetti-Stasi's user avatar
0 votes
1 answer
130 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 ...
Sivaji's user avatar
  • 2,478
0 votes
0 answers
67 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 ...
100IT's user avatar
  • 36
0 votes
0 answers
33 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
23 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
38 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
11 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
  • 376
-1 votes
3 answers
114 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
77 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
1 vote
2 answers
201 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,213
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
306 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
  • 179
1 vote
0 answers
112 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 ...
user avatar
1 vote
1 answer
36 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
  • 516
-3 votes
2 answers
140 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
278 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
71 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
22 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
36 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
339 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
328 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
139 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
162 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
26 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
141 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
100 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
211 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
1 answer
374 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
313 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
62 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
  • 41
1 vote
1 answer
461 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
383 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
691 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
50 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
79 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
155 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
153 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
3 votes
2 answers
962 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
  • 31
-2 votes
1 answer
69 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
  • 792
1 vote
1 answer
548 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,652
0 votes
0 answers
82 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
171 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
59 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?

1
2 3 4 5
50