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
5k views

How do I generate PDF of HTML in a custom module?

I want to generate PDF in my custom module. Using print module we can print node. But I have made html in my custom module and that I wanted to make pdf and save it in files. I have tried custom ...
1
vote
1answer
411 views

File creation date

I have a function in template.php: function test_file_icon($variables) { $file = $variables['file']; $icon_directory = drupal_get_path('theme', 'test') . '/images/icons'; $mime = check_plain($...
0
votes
1answer
386 views

File upload ajax and Radio Buttons not cooperating in registration form

I have enabled Profile 2 and profile Profile2 Registration Path modules on my site and have a really long registration form with lots of fields. I have some radio boxes and file upload fields also. ...
-1
votes
2answers
177 views

File upload form element that will allow the user to select files from server [closed]

I want to achieve (Create a form that will allow the user to select files from server) in Drupal 8.3 and have followed steps 1 to 4 but for some reason it's not working at my end. Can someone shed ...
0
votes
0answers
50 views

Files migration issue

I am following this tutorial on how to migrate files from D7 into D8. I have the migration setup with the following yml configuration: uuid: a685a4e0-1022-4bf2-a787-f6f1bef587ea langcode: en status: ...
2
votes
1answer
129 views

How to add an extra field in file upload widget?

I know that it is possible to enable a description field in the core file upload widget for Drupal 7. However, I want to add an extra description field like the one already present. For this I've ...
1
vote
2answers
828 views

How can I stop auto uploading of managed_file elements?

I am trying to create a field to upload the xml format of site map. But when I add a file to my filed it automatically uploaded and saved in the S3 bucket before I click on the submit button. The ...
0
votes
1answer
956 views

How can I get public files path in javascript files?

I want to display files present in the public folder(sites/default/files). So in the module file when I click on a link it will call to js function, How can I get all file names which are present in ...
0
votes
2answers
9k views

Get an error message “invalid file extension”

I always get the error message: "Invalid file extension" when I'm trying to upload a PDF file? Does anyone know how to solve that problem?
0
votes
1answer
188 views

What is the Drupal 7 version of FILE_STATUS_TEMPORARY?

My use case is that I want to set an uploaded file as FILE_STATUS_PERMANENT until I know it has been processed correctly by my custom module. Once that is done, I'm happy for Drupal to delete it. ...
0
votes
1answer
174 views

Cron job to transfer files to remote server

How would I go about scheduling a monthly file transfer (via FTP) to send files in a specific directory on my remote VPS to a server on my internal Corporate network? Once files are transferred, I'd ...
0
votes
0answers
332 views

mp3 not loading in opera and chrome when in private folder

I have audio on my site which is rendered through media module. The audio files are in private folder at sites/files/private In firefox, all is fine. But in opera 31 and chrome 45 the files do not ...
1
vote
2answers
703 views

Is there a html5 video player for Drupal 6 that run well on ios device?

I need to play videos on my drupal 6 site that would run well on IOS device (HTML5?). Is such solution available? My site currently serving flv files using jwplayer 6.x-1.1.
0
votes
1answer
633 views

How can I save a file in specific folder?

I want to upload files to specific folders. How can I achieve this programatically. How can I modify below code such that upload_location should be dynamic. $form['document'] = array( '#type' ...
1
vote
0answers
38 views

Extract compressed files

How to extract zip files after the upload successfully, I'm using File Field Paths to upload files.
1
vote
1answer
2k views

Remove uploaded files before the 6 hours cron?

I have a custom Content Entity in wich definition there is a 'file' field. The file widget works fine. The 'Browse' button allows to select a file and uploads it to the proper server directory and the ...
145
votes
11answers
186k views

What are the recommended directory permissions?

I'm gearing up to deploy a Drupal 7 site and I can't find any documentation about what the recommended security-conscious file and directory permissions should be set to. Specifically default/files/ (...
0
votes
2answers
550 views

How to save file to different server?

I want to specify a different file system remote server path. So that if I upload a file then this should be served from different remote server. I am using Drupal version 8.
-1
votes
2answers
153 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 ...
8
votes
1answer
2k views

Prevent file renaming

I have a user who is uploading a number of files with the same file name. It is important to them that the files are never renamed. However, the files are getting _1, _2, etc on the end. Is there a ...
2
votes
2answers
432 views

PDF version is different from Printer frendly version - using dompdf [closed]

Using the Print module, I managed to get dompdf working to some degree. However, there are differences between the 'printer friendly version' and the 'PDF version' generated, specifically with regard ...
0
votes
1answer
557 views

How do I make an FTP connection from a module?

I'm trying to create a custom module that would connect to an external FTP and grab an XML file (provided by third party). This file can't be accessed through http. In Drupal 8, there is the Drupal\...
3
votes
1answer
868 views

How do you upload an image via jsonapi?

The documentation is vague: https://www.drupal.org/docs/8/modules/json-api/working-with-files-post I am trying to upload an image following the sample code given for uploading a "document" on above ...
3
votes
3answers
4k views

How do I create a file download URL?

The function file_entity_download_uri() seems to no longer exist in Drupal 8.4, and I need to build a download URL for a file. I would not like to directly expose the file location.
0
votes
1answer
16 views

Form with manged_file filed is not submitted?

I have a form in my drupal module. in my form, I have used manged_file field. form name is "difference_form" and I have created two functions. one is "function diffence_form" for form definitions. ...
0
votes
1answer
613 views

Field formatter only displays file name not link to file

I installed Drupal 8.3.5, no extra plugins or themes. I have added in the "base page" (structure/type) a field (file_in) to upload files. If I add a new page (node/add/page) and also load a file in ...
0
votes
1answer
215 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 ...
5
votes
2answers
4k 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
41 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
324 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
120 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
586 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
626 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
33 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
13 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
0answers
11 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
31 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,...
0
votes
0answers
40 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
25 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 ...
0
votes
0answers
18 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 ...
2
votes
1answer
613 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
45 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
428 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
25 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 ...
0
votes
0answers
81 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
35 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. ...
-2
votes
1answer
54 views

Not able to access uploaded images in AWS

When we upload an image using the URL 'https://website.com/file/add' , the image is getting uploaded. While uploading, we have chosen the destination as ' Public local files served by the webserver' ...
1
vote
1answer
2k views

Max File Upload Size set to big, but Ajax Error with old file size

I have changed the upload_max_filesize and the max body size in my php.ini to 15 MB. It used to be 2 MB. Drupal displays the max file size correctly, but when I try to upload files bigger than 2 MB - ...