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
2 votes
1 answer
1k views

How to get an export option as a pdf for views?

I am using views on my Drupal site I can able to export my view in csv, but I am not able export my views as pdf I need to export my view as pdf. Any suggestions on this it will be very helpful, ...
-1 votes
0 answers
23 views

Ckeditor inline images won't be deleted from file system after node deleted, Drupal 10

I deleted the node, but noticed all the inline images which uploaded from ckeditor are still in the files/inline-images folder, am I missing something or these images wont be deleted at all ?
-2 votes
0 answers
59 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
0 votes
1 answer
966 views

Custom Ajax forms with managed_file form element

We have a form with three fields - where depending on the value of the first select field, we will show the other two form elements - one select field (the options depends on the value of the first ...
0 votes
1 answer
990 views

Migrating files from local source are not found

I am migrating from Drupal 7 to Drupal 8 (8.6.9). Both the Drupal 7 and the Drupal 8 site currently run on my local machine. The migration of the public files goes well using: source: plugin: ...
0 votes
1 answer
518 views

How to programatically change file user owner

I'm using the Services module. I can upload files through web services, but the problem is that all the created files have the same owner, the user account used for the web services. I would like to ...
2 votes
2 answers
576 views

How can I update file attachment and keep filename?

I understand changes of file attaching in D7, but problem is, if I delete and re-upload changed file, the deleted file is still on server and re-uploaded filename gets changed. If I understand ...
1 vote
1 answer
645 views

How do you programmatically create a webform with a managed_file type?

I haven't been able to find a single example of how to create a webform with a managed_file type. The webform initially had the type 'file', but needs to be changed to accept multiple attachments. ...
1 vote
1 answer
394 views

How can I have the file upload destination private by default?

Currently Webform file component uses public files as default upload destination. This is probably because private files path is not always available if not configured in Drupal settings correctly. ...
1 vote
1 answer
833 views

How to eliminate direct access to files in private directory?

I have set up my Drupal 7 site for private files in a directory above root (../private). I also set my filefield on my node type to upload the image files to that private directory. I have two user ...
1 vote
1 answer
1k views

How to add delete button to file field upload widget that actually deletes the file (not just association with content)?

After uploading a file with the File widget for the File field, the file is on the server and remove only disassociates the file from the field (and the content that the field belongs to). I would ...
0 votes
1 answer
483 views

Upload External File to Drupal File System

Situation I would like to be able to upload files programmatically from an external source to the drupal file system. I was thinking of making a RESTful API that allows me to save external files into ...
0 votes
1 answer
429 views

Organize node file attachments into groups

I have a content type with multiple file attachments to download. Is there a module to give authors the ability to divide all the attachments into groups, writing a title for every group, just like ...
0 votes
1 answer
456 views

How to add Download link to File field

I would like to know how I can make File field type display the upload as a download link, instead of having a link. So that user can just click and it will download). The file field type, I added to ...
0 votes
1 answer
633 views

How do I create a file download popup form?

I am new to drupal, and I want to create a popup form with with form fields for name and email, and a buttom to download and to close the popup. When users click on the download link, the popup form ...
1 vote
2 answers
477 views

How do I use print to generate a PDF of all entities referencing a specific node?

I'm trying to use the Print module to generate pdf's and epubs of the stories on my site. However, I need to get Print to generate these files from the story page and then generate the pdf with ALL ...
0 votes
1 answer
404 views

How to make uploaded file permanent to node without node submit

My module automatically save new empty node when user create new node and redirect to edit this node. Now, is it possible to make uploaded file on _node_edit form without submitting form? edit: When ...
-1 votes
2 answers
677 views

How to make file description field as required?

I would like to set the file description as required. I tried it with this code: function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_id ...
2 votes
1 answer
599 views

How can I load CSS files located outside the web root from within a custom module?

I need to store my css files at a location outside Drupal's path (e.g. /srv/assets/css/my_site/general.css). I attempt to achieve this using drupal_add_css but the browser loads them from: http://www....
0 votes
1 answer
624 views

Delete old files from server when content is updated

When a node is updated by replacing a new file upload, old files exist on the server maintaining versions. I want to delete old files from the server when content is updated.
1 vote
4 answers
531 views

Add another item by multivalued fields directly from node (or entity) view page

I have a file field which can have unlimited number of values. I am using File Entity module. As default, if users want to add more files, they must edit the node. I'm looking for a solution to give ...
14 votes
5 answers
27k views

How to get the url of a file field of a given node?

$node->field_file gives me a FileFieldItemList while the first entry seems to be a FileItem. $node->field_file->getValue() gives me an integer (I guess the file id). How can I actually get ...
1 vote
1 answer
709 views

How to make blob file downloadable?

I have created a Module to make blob file available for Download in Drupal 7 . Below my code for .module file <?php function blobfile_block_info() { $blocks = array(); $blocks['...
5 votes
4 answers
19k views

Can't edit settings.php in Drupal 7 - Premission Denied - Can't Write to File via Cpanel File Manager

Trying to edit settings.php via Cpanel File Manager I can CHMOD the file to anything I want and back but can't write to it. I get the following message: Could not write /home/testing&#...
14 votes
6 answers
6k views

How to make existing public files private?

Let's say I have a node type "Article" which has a field "File" which is set to handle public files. A lot of articles and files get added. Now the specs suddenly change and the "Article" will move ...
0 votes
2 answers
560 views

Limit the number of uploads per image field depending of role

I need a hook (or something similar) where I can set the number of image uploads depending of the role of the user. In the settings of the field there is no way to set the maximum number of values ...
0 votes
1 answer
72 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
1 answer
1k views

Remove an uploaded file

I am working with files in a Drupal module. I added this form: $form['Background_image'] = [ '#type' => 'managed_file', '#title' => t('Image'), '#...
3 votes
1 answer
900 views

How capture video thumbnail , when video is uploaded under media video type file?

I'm using Core media module to upload video[Media Type is video,which has field video of 'file field type']. This module will refer video.png as thumnail for all video uploaded from the local system. ...
0 votes
2 answers
15k views

Add header and footer for every pages printed

I've used print module version 7.x-2.0. I've used pdf-version and print-friendly-version. Now i want to do two different things. That is, Is it possible to add separate CSS for pdf, html or email ...
0 votes
1 answer
162 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
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 ...
14 votes
3 answers
14k views

How do I save uploaded file permanently in file_manged table?

How do I save a uploaded file with status equal to 1 in the file_managed table, in Drupal 8? Whenever I upload a file, it is stored in the file_managed table with status value 0. I have used File::...
2 votes
1 answer
676 views

how to bypass video conversion for mp4 files?

I am using the Video module on my site, and would like a would like to bypass video conversion and a user uploads a file in MP4 format. Is there any way that the bypass video conversion? The reason ...
0 votes
0 answers
82 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 ...
0 votes
1 answer
412 views

Custom feed tamper plugin to convert an image GUID into a URI

I have a feed importer for image files, which stores a column in my source csv as the GUID of the final files in Drupal. I also have another importer for, say, articles. In the articles csv, there is ...
1 vote
1 answer
4k views

I am getting temporary file could not be copied because the destination directory is not properly configured error

The specified file temporary://fileDTbhYD could not be copied, because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More ...
0 votes
1 answer
917 views

How to download the files data attached to webform

I have webform with text fields and file upload field. How can i download the all the documents which was uploaded through this webform.
2 votes
1 answer
607 views

Rule to send an e-mail with the URL of an uploaded attachment after node change

I have a Drupal 7 site with a custom node type with a custom attachment field. After a (kind of this custom) node has been published, I got an e-mail with the help of Rules module. I would like to set ...
4 votes
2 answers
1k views

How to select files from /sites/default/files with IMCE filebrowser?

Somehow the settings of directories in the configuration of IMCE (7.x-1.7) is pointing to <root>/. which lets met start in the private_files directory but not in the (public) files directory. I ...
1 vote
0 answers
48 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
1k views

File field upload in modal/dialog

I have a custom content type with file field as one of the fields. For theming/UI purposes I should make this file field as clickable button. And only when user clicks on it, he/she gets modal window ...
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 ...
1 vote
3 answers
1k views

Link manually uploaded file to files-private folder

I have uploaded a large size folder via winscp to a external hosted server to the files-private folder in drupal. when i try to access the index file inside the folder in browser i get access denied. ...
2 votes
2 answers
1k views

How can I attach multiple pdfs to drupal_mail() function?

Was doing something like this global $base_url; $uri = $base_url . '/sites/default/files/test.pdf'; if(!empty($mail_content)) { /*send mail */ $to =$...
1 vote
2 answers
818 views

Hide Alt and Title for image field

How to hide Alt and Title fields for anonymus users when they upload images? I use tokens for these field that's why I need to hide them.
1 vote
1 answer
1k views

Retrieve file URL when upload form is submitted

I have the following code in my form. function video_subtitles_menu() { $items = array(); $items['video_subtitles_test/upload'] = array( 'title' => 'Upload Subtitle', //page title '...
0 votes
2 answers
2k views

How to open file in new tab instead of download when submitting form?

The code below downloads the current file, I need it to open the file in a new tab, what needs to be added in order to do so? public function submitForm(array &$form, FormStateInterface $...
0 votes
1 answer
659 views

How to submit form on selecting image in file select widget?

I am using Drupal Form API to upload profile image for user. I found two file upload widgets in FORM API: '#type' => 'managed_file' & '#type' => 'file' managed_file requires first ...
2 votes
1 answer
998 views

Unable to set file upload destination private when programmatically creating new content type with file field

I am creating a module to upload video to an in house media converter - as part of the module installation I create a new content type called "user video" which has a file field as part of it. I need ...

1
2 3 4 5
50