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
1answer
473 views

How to redirect all images in the files folder to a default file?

Because we work with DTAP environments, our developers work on their own laptops. To get a good view of the live environment, we copy the PROD database and the files to our own laptop. However, this ...
1
vote
1answer
543 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 ...
2
votes
2answers
516 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 ...
0
votes
1answer
365 views

Adding zip archives to the Document File Type

I have many PDF documents in my site, assigned to the Document File Type by the File Entity Module. I have added a few fields to the content type, thus allowing nice interface in showing all PDF ...
0
votes
1answer
548 views

Module webform2pdf modify template

I have sereval webforms et each webform send a mail with a pdf. I would like to do a template for each webform. I use webform2pdf in Drupal 7 to send pdf by email. How can i do that ?
0
votes
2answers
38 views

How to reuse existing images in field type “Image”

I have custom ContentType with one field of type Image. Currently, when I edit a node I can only upload new images from local to server. I want to have the option to select images already existing on ...
0
votes
1answer
12 views

Modify the error message about the maximum upload file size

I would like to modify the default error message for the maximum upload file size, but I can't find the configuration. I looked at webform general settings, individual settings, and media file ...
0
votes
0answers
39 views

Upload button not showing

I am using Drupal 8.4.2. I have created my content type and I have an image field in the form fields. The image upload field is showing on the page but, the upload button is not showing. If I ...
2
votes
1answer
385 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, ...
0
votes
2answers
498 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
1answer
409 views

How to file_save_data with utf encoding?

file_save_data is saving files with ANSI encoding. I want utf8. How can I specify encoding?
0
votes
0answers
46 views

Detect when a new image is uploaded to my server

I have created a custom app that will allow logged in users to upload an image which will be automatically uploaded to my web server through SFTP method. Is there a module or even programmatically ...
0
votes
1answer
541 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
4answers
511 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 ...
0
votes
2answers
813 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
2answers
373 views

Can I use plupload to load multiple image files into a single image field

I have an image file field on my Drupal 7 site that allows users to add 4 images. I would like to give my users the ability to load all 4 images at once. I have discovered the plupload module and ...
0
votes
2answers
762 views

RewriteRule causing internal redirect limit error

I am trying to server a static HTML site from /sites/default/files/staticsite and make it available via a subdomain. I'm hosting the site on Acquia Cloud, and their docs describe Maintaining a static ...
4
votes
3answers
2k views

How to allow for files of any extension to be uploaded?

I'm surprised this hasn't been asked before like this. I want to allow users to upload files of all file extensions, without enabling each extension by hand. How do I do it?
0
votes
1answer
27 views

How can I register an already uploaded unmanaged file as managed file?

I am stuck in a point that should be easy but I couldn't figure it out. To make a long story short; I uploaded manually some images to the public directory and now I want to register them as managed ...
2
votes
1answer
562 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
1answer
932 views

Why is JW Player not working in custom Content Type?

I am having a weird problem. I downloaded JW Player and used it on my page (Default Page Content Type) to show video. It worked seamlessly. Now there was one requirement that there would be a page ...
1
vote
1answer
1k views

How do I delete files attached with media entity in drupal 8.4.2?

Background: drupal 8.4.2 custom media solution Issue I can not delete files permanently which created as media entity. Reproduce Created an image media entity. /admin/content/files claims status ...
0
votes
0answers
11 views

Storage API + Services 3: How to work together?

I am trying to set up a site that will be storing a large amount of images. I am using Storage API module for that and It is working fine through web. Now I need a REST Service to upload images. I am ...
2
votes
1answer
845 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 ...
0
votes
1answer
23 views

The security danger of publicly exposing an upload field

On older drupal 7 websites I once faced security patches for the webform module, because file upload fields were considered insecure. There was en exploit where people could end up uploading .html ...
1
vote
2answers
143 views

Field formatter module throws cannot declare class error

I am trying to write a custom module, which defines a field formatter plugin, but when I visit the Manage display page, I get this error: Fatal error: Cannot declare class Drupal\my_formatter\...
0
votes
1answer
558 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 ...
0
votes
1answer
556 views

Delete old files from server when content is updated in Drupal7

When a node is updated by replacing a new file upload, old files exist on the server maintaining versions.I want delete old files from server when content is updated in Drupal7
0
votes
1answer
17 views

Change path of uploaded files in zip

I've a form that allow the customer to download every photos that a photograph uploaded before. Here is my submit form : public function submitForm(array &$form, FormStateInterface $form_state) ...
0
votes
1answer
899 views

The “Remove” button is not working

I'm using a "managed file" to upload an image, which works fine, but if you want to remove the image by clicking on the "Remove" button, nothing happens. $form['logo'] = array( '#type' => '...
6
votes
1answer
960 views

Upload multiple files through a single file dialog?

In a Webform, I want to let the user upload multiple files via one call of the file dialog. I found the following modules. Webform Multiple File Upload Webform Multiple File With either of them, I ...
0
votes
1answer
662 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.
1
vote
1answer
389 views

How to load CSS files located outside Drupal's path 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....
1
vote
3answers
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. ...
0
votes
1answer
584 views

Customize Commerce Event Ticket PDF content

I'm running Drupal Commerce and Commerce Event Tickets on a client site. I'm trying to figure out how to customize the content of the ticket PDF that is generated by the module, and I'm stumped. It's ...
0
votes
0answers
34 views

Phar not working in Drupal 8

If I try to use a simple Phar call in my controller: $tar = new \PharData('/path/to/myTar.tar'); I get the error: "Unexpected file extension" This is because Drupal Security checks to see if the ...
2
votes
2answers
714 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
2answers
411 views

Delete unmanaged file after download?

In a custom module I create a file and then use drupal_goto to download it. How can I delete the file after it is downloaded? Placing a file_unmanaged_delete after the drupal_goto doesn't get executed,...
10
votes
1answer
4k views

Load a file entity by URI

Is there a way to load a file by URI in Drupal 8? In Drupal 7 it is possible by the next example: $uri = 'public://file.xyz'; // Take a look at: file.inc::file_load_multiple $files = ...
4
votes
2answers
6k views

How can I load a File entity?

I want to find out whether a physical file is managed by Drupal and if it is, then load it. I'm having trouble with the documentation which keeps displaying "File not found" at crucial moments, but ...
1
vote
2answers
634 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.
0
votes
1answer
414 views

How to add Table of Contents in a PDF?

I am using the Drupal Print module to create downloadable PDF from my site. This works very well indeed. But I would like to have a table of contents in the left region of the downloaded PDF. For ...
0
votes
2answers
759 views

Migrating to XAMPP local install - Configure the temporary directory

I have copied a site I have on a VPS down to run from XAMPP on my local machine. When I restore the site using Backup and Migrate I get the error message on all pages of the site: The specified ...
0
votes
1answer
372 views

Youtube Videos won't load and display properly using Embedded Media Field

I just noticed that my youtube videos are not showing up properly now on all my websites running Drupal 6. It seems this happens with any Youtube video which is displayed using the Drupal module " ...
0
votes
1answer
514 views

Theme file upload form element

I want to theme all the file upload fields on my site but I don't know how to name the template file. I want to alter the form-element.html.twig file but as I have multiple file fields I don't think ...
0
votes
1answer
794 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'), '#...
2
votes
1answer
46 views

How do I delete files using the Content > Files interface?

I got a ticket from our stakeholders that certain outdated PDFs are googlable, and this is causing problems with people going on old information. Navigating to admin/content/files, I am able to find ...
1
vote
1answer
2k views

Adding the video field to a content type

We've been using an SWF player for a while. I added the Video module without adding a new content type, just to see if the HTML5 tag worked. It does. However, that obviously doesn't give us an SWF ...
2
votes
1answer
2k views

How to rename uploaded files

Using Drupal 8, I want to rename and clean all filenames, e.g. If someone uploads file named like this Screen Shot 2016-03-29 at 1.13.21 PM.jpg, I want to clean it so that convert all spaces to dashes ...
1
vote
1answer
832 views

temporary://fileh4Oxvi could not be copied, because the destination directory is not properly configured

I am using Advagg and Amazons3 Module, which is causing this error: temporary://fileh4Oxvi could not be copied, because the destination directory is not properly configured. Files are getting ...