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
0answers
12 views

“File upload error. Could not move uploaded file. The favicon could not be uploaded.”

How can I solve the following error when I am trying to upload an image into a Drupal 8 website? File upload error. Could not move uploaded file. The favicon could not be uploaded.
1
vote
0answers
10 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 ...
0
votes
0answers
34 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: ...
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
24 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
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 ...
-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
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 ...
0
votes
0answers
26 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(!...
-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,...
0
votes
1answer
20 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
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 ...
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 ...
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 ...
0
votes
1answer
33 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. ...
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
96 views

Drupal 8.7.0 chmod() and touch() operations not permitted

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
12 views

Setting default upload paths for media

I really want to have an organised files folder in my d8 project. I have two main media fields: field_banner AND field_image They appear in all my content types. I would like that all the the media ...
-2
votes
1answer
51 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' ...
0
votes
0answers
12 views

Using image styles with a normal “managed file”?

I created a content type with 4 fields on it: Private Image Field Public Image Field Private File Field Public File Field I am able to access 1 and 2, as they are image fields. But if I upload an ...
0
votes
0answers
35 views

How can I replace static file and media links in content with their equivalent entity references?

I imported content from another system. So, for example, the body has typical html, like this: <img src="/images/image.jpg /> All of the media assets that are referenced as static html, those ...
0
votes
0answers
17 views

How can I get an image form to maintain image order after deleting one?

I have a content type with a field for images. The field accepts multiple images and after I upload several, I re-arrange them to a desired order. After re-arranging them, I can enable "Show Row ...
0
votes
1answer
29 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('...
0
votes
0answers
8 views

managed_files with named that already exist are being renamed, but original file name returned

I am trying to add image upload functionality to my custom module. Images are successfully being uploaded via the following: ` $form['slide']['dbs_img'] = array( '#type' => '...
0
votes
0answers
36 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 ...
0
votes
1answer
172 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::...
-2
votes
1answer
41 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/...
1
vote
2answers
136 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 ...
0
votes
0answers
18 views

How can I bulk add multiple taxonomy terms to existing media files, or reimport with terms?

At an earlier stage of a project approximately 30,000 files were uploaded to a Drupal 8 site through the Bulk Media Uploader. Now the project requires that taxonomy terms in an existing vocabulary be ...
1
vote
1answer
181 views

Will my managed file get deleted?

At this url: /admin/config/media/file-system There is a setting: Delete temporary files after X hours Does this specifically refer to files in /tmp ? Or whatever I set as my temporary folder? Or ...
0
votes
1answer
29 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 ...
2
votes
0answers
83 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....
0
votes
1answer
296 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: $...
1
vote
1answer
145 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 ...
0
votes
1answer
30 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 $...
0
votes
1answer
72 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 ...
0
votes
1answer
41 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 '...
0
votes
1answer
80 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 ...
0
votes
1answer
23 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. ...
0
votes
1answer
51 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(); ...
0
votes
0answers
35 views

Can't get correct sequence and link to file in preprocess swiftmailer

I'm trying to pass Drupal 8 core Contact form data to a custom designed Swift Mailer template. The way I'm trying to do this is by getting all the fields dynamically to the template. function ...
0
votes
1answer
42 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 ...
0
votes
0answers
31 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 ...
0
votes
1answer
55 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 ...
0
votes
1answer
48 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: ...
0
votes
2answers
76 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?...
0
votes
1answer
15 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 ...