We’re rewarding the question askers & reputations are being recalculated! Read more.

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
558 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
930 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
844 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
142 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
557 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
12 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
898 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
938 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
658 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
386 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
33 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
707 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
406 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,...
9
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
413 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
753 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
370 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
507 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
788 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
44 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
822 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 ...
0
votes
1answer
36 views

Replacing a pdf

I am looking to delete a file permanently. It says that is is not being used in any places and I have deleted it, but it is still showing up. I want to replace it, but Drupal just keeps making a new ...
0
votes
1answer
63 views

Force download string as text file

I'm trying to return the results of a db_query as a raw text file. The php solution uses header() to instruct browsers to download content. I've attempted using header() in an AJAX callback function, ...
1
vote
3answers
791 views

How to implement access permissions per individual field and individual nodes?

I know there is https://www.drupal.org/project/field_permissions module, which allows to set field permissions per role, however what I need is to provide each individual field access permissions. As ...
1
vote
4answers
2k views

Ajax error while uploading or removing file through managed file

I am getting following error while using managed file through my custom form. "An Ajax HTTP request terminated abnormally." Also, I updated my jquery version to latest using jquery_update module. ...
0
votes
0answers
39 views

Set two file_public_base_urls and two file_public_paths in settings.php

I need to set two file_public_base_urls and two file_public_paths in settings.php in Drupal 8.7. and have them associated with each other. For example: $settings['file_public_base_url1'] = 'http://...
0
votes
2answers
2k views

CKEditor and IMCE: how to access to public files directory

I have a problem that I can't access public files directory from IMCE as file browser (and CKEDITOR as editor). When an user write a blog post, he can't upload images to public directory because this ...
1
vote
1answer
838 views

Field widget item form alter for file field

I want to alter field widget item form of a file field with cardinality > 1 so that a new form element is added to each row of the file tables. For example, in the attached image, I want to add ...
1
vote
2answers
1k views

“File (Field) Paths” and “Media” modules: files not saved in the intended folder

I'm trying to use both the "Media" module (1.4) (to manage uploaded files) and the "File (Field) Paths" (to keep the uploaded files organized in various subfolders). Basically, I have a content type ...
2
votes
1answer
882 views

Clear managed_file field on submit

I'd like to clear the managed file field each time the contents are sent off for further processing on submit. The callbacks work fine, but I have repeatedly come unstuck in my goal of having a "...
2
votes
1answer
858 views

How do I integrate media (e.g. attaching audio) to nodes?

I installed the Media Entity module for Drupal 8. I thought it would somehow facilitate adding Mp3, etc, as Media does in Drupal 7, where I could specify a media player type for an audio file. (And ...
1
vote
1answer
1k views

Retrieve File Url from Upload Form When Form is submitted

I have the following code in my form. function video_subtitles_menu() { //print "video_subtitles_menu 1";exit; $items = array(); $items['video_subtitles_test/upload'] = array( //this creates ...
4
votes
2answers
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 ...
0
votes
1answer
1k views

Large file uploads stop immediately, 404 error

I am having a weird problem with uploading large files in the Drupal admin's file field. I have the size limit set to 500 MB. I also have the php.ini settings for upload size, post size, and memory ...
0
votes
0answers
24 views

How do I load a file in a managed_file field inside an edit form?

I'm building a custom module (Drupal 8) which implement new elements I called components. I have a component creation form which has a managed_file field which works well, it submits, save my image ...
0
votes
1answer
363 views

Problem with swfobject_api or jwplayer module

I have a problem with swfobject_api or jwplayer module. When I use this code in node.tpl.php everything is fine. $config='sample'; $flashVars=array( 'file' => 'path to flv' ); print theme('...
0
votes
1answer
22 views

How do I reference a file field and node title from another content type & node?

I need to add a link to a file, added through a file field on its own content type called "Document" from another content type and node call "plan information". The idea is that the "document" nodes ...
0
votes
2answers
243 views

chmod() and touch() operations not permitted [closed]

After updating drupal8 for 8.7.0 and then to 8.7.1 versions i have next errors: Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line ...
0
votes
0answers
34 views

Private file upload using core's contact module

I am using the core contact form module for user applications. I have set a private file upload directory in settings.php. When the user submits the application form I require them to also upload a CV ...
4
votes
2answers
1k views

Upload file and fill in fields in one step; or trigger a rule when a file is uploaded

I want to make use of the Media module and the File entity module to upload files, in particular images, to my site without having to attach them to a node. Solely uploading images works like a charm, ...