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
2answers
485 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
340 views

My ajax is altering form action/URL thus makes me impossible to read the $tid from it

I am using WEBFORMS which have as the topic taxonomy terms saved as hidden fields. Unfortunate, after attaching files using Upload button this terms are lost ('No category'), as ajax is altering the ...
0
votes
1answer
527 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 ...
0
votes
1answer
33 views

D8 | Custom Form managed_file field limit number of upload files

I have a custom form in D8. Form has managed_file field. I am facing challenge regarding the limit of number of files upload to this field. I have to make this managed_file field to upload only 3 ...
0
votes
1answer
710 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 $...
4
votes
2answers
3k views

How to do file downloading in a controller function?

I asked the question about downloading of files upon submitting a form. Now I want to clarify how to do it in the case of controller function. That is, some controller is called and its function is ...
0
votes
0answers
28 views

file_exists with 'replace' or 'use existing' not working when a variable is passed

Can somebody point out the fault in this snippet for downloading a file entity. I am trying to replace or use existing file dynamically using migrate_plus. When I give a variable it doesn't seems to ...
1
vote
2answers
293 views

How to get the File Description on a custom field formatter?

Greetings to all of you. This is my first question posted around here, so any suggestions are welcome on improving how to better formulate questions. Into the matter. I have the following code in a ...
0
votes
2answers
108 views

Add Field as Entity in Group Module

The group module is an alternative to the og module. The og module allows you to assign permissions to fields per group. I would like to be able to do the same thing with the group module. It ...
-1
votes
1answer
412 views

How do I implement Download Count?

I am trying to sort my view of documents by "most downloaded". I see that there are only a few modules, Download_Count being one. There is no documentation on how to implement this. I have installed ...
0
votes
2answers
594 views

How do I migrate the file attachments field from a content type?

My Drupal 6 site has different content types, and there is a File Attachments field added to the content types. While migrating to Drupal 8.1, this field is not getting migrated, but the attached file ...
-3
votes
1answer
28 views

change of Public file system path [closed]

how can i change Public file system path in drupal 8 ? And can you tell more about how to increase the storage of database?
0
votes
0answers
8 views

Is it possible to use the path alias token as file path with filefield_paths module?

I'd like to use the path alias in order to create the folder structure of the uploaded file. First of all I could not find the correct token in the list and after a while decided to create my own ...
0
votes
0answers
11 views

Acess denied to files set as permanent in tmp folder

I made a module that saves custom files in the tmp folder when users add a product to the cart, and move the file to private folder when the order is submitted. If I set the file status to 0, users ...
0
votes
2answers
350 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 ...
1
vote
4answers
508 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
0answers
9 views

Files not being saved in sites/default/files

I am having a problem when I upload a file in Drupal 7 through content/files and click on add file. The URL path for the file is always saved as files/ instead of sites/default/files/. In ...
-2
votes
1answer
22 views

Encrypt images before node saving and decrypt them when a node is viewed

I am searching for a way to encrypt images before saving them on server (private folder) and decrypt it when node is rendered for roles that have views permissions. I found the Encrypted Files module,...
2
votes
1answer
543 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 ...
1
vote
1answer
922 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
27 views

Drupal 8 uploaded should be stored in certain s3 bucket

Currently, I'm facing an issue while uploading a file. I'm fetching the file tid with hook_entity_presave: $file_tid = $entity->get('field_photos_photos') ->getValue()[0]['target_id']; if(!...
0
votes
1answer
554 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
542 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
918 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 ...
0
votes
1answer
22 views

Programatically copy an image from user entity to webform submission entity [closed]

Using a custom webform handler, I am trying to copy an image from the image field (field_usr_avatar_img) located at the user account page to the image element (avatar_img) located at the webform ...
6
votes
1answer
787 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
0answers
16 views

File uploading issue

We're having issues uploading files. Some files encounter an error message that states The specified file temporary://p1dah901n910tl8lv14.tmp could not be copied, because no file by that name ...
4
votes
2answers
331 views

Detect when 'Remove' is clicked on a file widget form element?

I have a handful of file fields that have the following default Drupal behavior: User can upload a file User can upload another file in place User can remove file Standard config. Whats happening is ...
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. ...
1
vote
1answer
356 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....
0
votes
1answer
27 views

How to define allowed file extensions to file field in installer yaml?

I need to add 2 fields to an existing content type in Drupal 8 website, one is text another is file type, I have a multisite setup so I need to add for every locale site, Now I have created a module ...
2
votes
1answer
594 views

How do I make the file description field required?

In Drupal 7, I need users to enter a file description, how do I make this field required? Also on another note, I would love to make this field a select list, there's no clear way to do this aside ...
0
votes
2answers
2k views

How to use managed_file to upload many files

I'm looking for a way to upload many files by means of the managed_file form API element. I would like it be like while uploading for node where is 'add new item' button. How to do it?
0
votes
1answer
581 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
1answer
635 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
2answers
622 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
34 views

How do I override the base URL for private files?

Why in Drupal 8 is possible to override the base_url for public files using the file_public_base_url but not for private files? There are scenenarios where Drupal is installed behind a reverse proxy. ...
-1
votes
1answer
384 views

How to set title for video embed field

I've a video embed field, where I've a youtube video link, I've printed the same on the twig. But it seems not to have the title for the iframe. How can I add one for iframe in drupal 8.
0
votes
0answers
24 views

Steps to make a private file system working on a fresh install?

How can i make my media files stored as private and protected? The users shoud only have access to that file if they click from the node file link, on nodes they can access to. On a fresh install,the ...
2
votes
2answers
679 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 =$...
0
votes
0answers
37 views

Prompt user to download file via AJAX form submission

I have a file that is generated when an AJAX button is clicked. I want to immediately have a file download prompt come up. The file is being generated and has the correct data in the file. I just don'...
0
votes
0answers
34 views

Images not being uploaded to defined Image Style folder on server

Drupal 7 site. For over 5 years we've had no trouble uploading images to view with a blog. This weekend we had Ningx loaded on our server. Hosting co. is certain that's not issue. Maybe it isn't. ...
0
votes
1answer
353 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
411 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 ...
1
vote
1answer
764 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 ...
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
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 ...
0
votes
2answers
1k 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
826 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
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. ...