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
0 answers
325 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 ...
Hyco's user avatar
  • 3
0 votes
0 answers
101 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 ...
Lloyd_07's user avatar
0 votes
1 answer
63 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 ...
Rob Orr's user avatar
  • 399
0 votes
0 answers
362 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://...
newdrupaluser's user avatar
-2 votes
2 answers
1k views

Upload file to S3 directly instead of using temporary storage

I have one file uploading form in Drupal 8 where I am uploading 3 different assets and they might be around 2gb or more in size. I have the s3fs module enabled and configured properly, but (due to ...
Vaibhav Gidde's user avatar
0 votes
1 answer
2k 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, ...
Ghoti's user avatar
  • 123
0 votes
1 answer
47 views

Additional file entity fields in widget_form

I've added additional fields to my file entity types and would like to have them in upload widget, just like file description. How can I add my custom fields element using field_widget_form_alter? (...
rmorelli74's user avatar
0 votes
2 answers
142 views

Filebrowser thumbnails "can not create img for private://"

I am using Drupal 8.7.5 and PHP 7.3.7 running on Apache 2.4.6. UPDATE: I'm trying to make available a library of images to the public. I chose the content type of 'Directory listing' to do this. In ...
Tom Robinson's user avatar
1 vote
1 answer
2k views

How to set the public file path to migrate site files and images through Migrate Drupal UI

I am working on migrating a drupal 7 site to drupal 8 site that has image fields in content types, as well as some pdf files that I am trying to migrate through the Migrate UI. None of those files are ...
tonytheferg's user avatar
1 vote
0 answers
198 views

How can I migrate an Amazon S3 bucket to into Drupal?

SCENARIO I currently have a bucket where all my images are hosted and stored. I currently display them by simply using URLs that link to the images (i.e https://[bucketName].s3.amazonaws.com/[...
B. Cratty's user avatar
2 votes
1 answer
219 views

File upload via REST returns 403

I've been attempting to get a file to upload using REST services and have been having a heck of a time getting it to work. All attempts come back as 403 (Forbidden). Here's the code: export const ...
Kevin Simpson's user avatar
0 votes
2 answers
835 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: ...
sisko's user avatar
  • 1,710
0 votes
1 answer
19 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. ...
Mehrdad201's user avatar
  • 1,302
0 votes
0 answers
180 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 ...
wilNev's user avatar
  • 433
-3 votes
1 answer
830 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?
Ajeet Yadav's user avatar
-2 votes
1 answer
119 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,...
Mehrdad201's user avatar
  • 1,302
-1 votes
1 answer
53 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 ...
user avatar
0 votes
1 answer
271 views

How to add file extensions while creating a field (type file) through the module installer.yaml?

I need to add 4 fields to an existing content type in Drupal 8 website, 2 of them is text another 2 is file type, I have a multisite setup and have 30 country-specific sites so I need to add for every ...
sekharctc's user avatar
  • 131
0 votes
0 answers
69 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 ...
Matoeil's user avatar
  • 3,359
0 votes
1 answer
206 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. ...
mordonez's user avatar
3 votes
1 answer
1k 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'...
FatGuyLaughing's user avatar
0 votes
0 answers
40 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. ...
Neil's user avatar
  • 1
0 votes
1 answer
2k 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 ...
DARK_DIESEL's user avatar
-2 votes
1 answer
154 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' ...
N N's user avatar
  • 1
0 votes
1 answer
391 views

How to download from private// following a link?

I have a custom entity (contract) created in a custom module (amap) by a bunch of BaseFieldDefinition, one of which being $fields['file1'] = BaseFieldDefinition::create('file') ->setLabel(t('...
gbmapo's user avatar
  • 1,066
0 votes
0 answers
66 views

Grant file access to file downloads

I am able to sell a file using Ubercart Drupal 8 module. However, file download permissions are not granted to the user purchasing the file. Do we have a Rule in place for this? How can I achieve ...
Prerit Mohan's user avatar
1 vote
1 answer
2k views

How to alter response headers from module hook

I am puzzled how to alter the response headers from specific hook (hook_file_download)? /** * Implements hook_file_download(). */ function example_file_download($uri) { $scheme = FileSystem::...
tslid's user avatar
  • 159
-1 votes
1 answer
609 views

Strategy for Import/exporting Drupal8 as content and structure

We are setting up feature>dev>production environments on Platform.sh for a Drupal 8 project. Expecting multiple contributors to the project, we have run into a slight snag regarding Importing/...
dimmech's user avatar
  • 235
3 votes
2 answers
4k views

Download file programmatically

I have a custom module where I need to create a file and download it on form submission. So far, I managed to created the file and save it in public folder, but I cannot find a way to download it to ...
Dimitris Markopoulos's user avatar
2 votes
1 answer
641 views

Will temporary file get deleted?

On /admin/config/media/file-system, there is the Delete temporary files after X hours setting. Does this specifically refer to files in /tmp or in the temporary folder? Does t possibly delete "...
rockstardev's user avatar
  • 1,039
0 votes
1 answer
84 views

Can't Write to Public Files but Permissions Appear Fine

Need the internet to confirm my sanity. On a Drupal 7 site it's saying "The directory sites/default/files is not writable." So I checked every permission but I don't see the issue. Since this isn't a ...
Aaron Chamberlain's user avatar
3 votes
1 answer
2k views

How can I create an alias to point to an uploaded file?

Users uploading a file within content create a name like my_site.com/sites/default/files/import/CrazyLongNamefile.pdf They would like to alias it for referencing in other media (print) like my_site....
Doug Johnson-Cookloose's user avatar
6 votes
3 answers
8k views

Get raw and relative path of a file uri

I have a file with an uri and I want to get its raw and relative path. Uri: public://videos/Test Video.mp4 Path: /sites/default/files/videos/Test Video.mp4 I found already a way to do this: $...
btemperli's user avatar
  • 402
9 votes
2 answers
6k views

Site seems to miss the "private" wrapper, how can I fix it?

I can not enable the private folder getting the warning as below: Warning: file_exists(): Unable to find the wrapper "private" - did you forget to enable it when you configured PHP? in ...
Paul Paku's user avatar
  • 445
0 votes
1 answer
201 views

File upload through form type file

My Drupal version is 8.6.10 I am trying to upload a file through the file_save_upload function and the function is looking for the file in Symfony\Component\HttpFoundation\FileBag Object $...
Ilya webdev's user avatar
0 votes
1 answer
745 views

How to download file from URL manually?

I need to upload on Drupal 8 a file from an URL programmatically without using a form and a field type 'managed_file'. I'm not sure how to do this, I found different web pages on it but it's often ...
gduh's user avatar
  • 103
0 votes
1 answer
492 views

for anonymous user, webform not submitted because of private file

I have one webform which contain the private file field. As admin user: i can upload the file and submit the form. As anonymous user: i can upload the file but while saving the form, i am getting '...
Sunil Pawar's user avatar
0 votes
1 answer
1k views

How to output multiple files url entities on twig?

I have a file entity field that I can upload multiple files and I'm trying to render or display it inside my node twig template. The code below is what I'm trying to make it display. Tried clearing my ...
Punya Ruchal's user avatar
0 votes
1 answer
36 views

Where files are used if path entered by hand

I am brining a 100 or so static pages into my drupal install here. We are pasting the content from the static site into the body of a content type. I am using ICME to upload the images and documents. ...
jasonflaherty's user avatar
0 votes
1 answer
785 views

Why getMimeType() is returning wrong value for xlsx file

Below is my 2 line code to get the Mime Type of an attachment in a preprocess function $file = $node->get('field_attachment_file')->entity; $variables['attach_type'] = $file->getMimeType(); ...
NKP's user avatar
  • 137
0 votes
1 answer
67 views

Remove file pages

Forgive me if this has already been addressed, I searched for it but couldn't find a similar issue. I'm using the file entity module and it automatically generates a page for each of the files. This ...
themantimeforgot's user avatar
1 vote
0 answers
160 views

FillPDF Generating PDFs of 0 bytes when using local PDFtk

We just moved from Scientific Linux to Ubuntu, and as a result have moved from FillPDF Local Server to locally installed PDFtk. All PDFs that are generated are now 0 bytes. There are no related ...
Pablo Gosse's user avatar
0 votes
1 answer
838 views

Permission for private file to anonymous

I have an ad content type, with a file field that is in a private directory when saving the node. Ads and their files are only accesible for authenticated users. I wish I could allow anonymous users ...
user71007's user avatar
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: ...
hepabolu's user avatar
  • 248
0 votes
2 answers
1k views

Where in The Database does File Usage Data Come From

How does data in file/[id]/usage get compiled? From what tables does it determine a use? Is there a way to track down how/where it gets this data and troubleshoot? Does it take include revision data?...
Sam's user avatar
  • 585
0 votes
1 answer
40 views

Uploaded files don't appear on the page

My research I have browsed some of the other similar questions asked regarding this but the fixes do not work for me so I figured I'd ask a new question in the hopes that I can help myself and ...
Ember's user avatar
  • 101
0 votes
1 answer
72 views

Groups and Private File Visibiility

I have created a content type Agenda - the body is paragraphs - there are two types: (1) Text and public files and (2) Private Files. The fields work properly - Anonymous cannot see Private Files. ...
FolioGuru's user avatar
0 votes
0 answers
506 views

How to password protect private files

I would like to protect private files with password in a content. For example, I created a content with some files, this field "Protected files" uses private filesystem. I would like to protect these ...
asrob's user avatar
  • 461
4 votes
2 answers
5k views

How to print alt or title field image in custom block programmatically?

I want to print alt or title field image file in custom module Drupal 8. I load file entity use Drupal\file\Entity\File; I checked core/modules/file/src/Entity/File.phpall public function but not get ...
Pankaj Yogi's user avatar
0 votes
1 answer
27 views

How do I integrate a custom filter inside a view

I am using entity browser to view my uploaded images. And now I want to integrate a new filter to the view. My objective is to filter the images from the URI path. Currently view has a field in Filter ...
i am batman's user avatar

1
3 4
5
6 7
50