Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

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
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
55 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 - ...
0
votes
2answers
1k views

Where is FID xxx used?

Is there a way to see where a file is used, with FID? I see the entry in the file_managed-table (Drupal 7), but not where it is used.
4
votes
1answer
3k views

How do I create a Url object from the public file URI?

How can a Url object be created from a file URI? Using the URI for a public file as a parameter for Url::fromUri() gives this error. UnexpectedValueException: External URLs do not have internal ...
2
votes
1answer
525 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
2k views

Programmatically upload a file to a custom file field

I am trying to update a node and programmatically upload a file. $nid = 45343; $node = node_load($nid); $image_url = 'http://test.com/misc/druplicon.png'; $file = system_retrieve_file($image_url, ...
0
votes
0answers
13 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 ...
1
vote
3answers
3k views

Entity print get variable in twig template

I'm using entity print and I would like to get node variables in my twig template, so I can call them like {{ content.field_name }}. I tried using a preprocess function but I'm not sure I'm doing ...
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
35 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
42 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
292 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::...
12
votes
4answers
17k views

Storing data / session for anonymous user

I am working on a shop, and for the cart, i need to store items before payment. $tempstore = \Drupal::service('user.private_tempstore')->get('boutique'); $tempstore->set('poids', $...
-2
votes
1answer
47 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/...
0
votes
2answers
327 views

Image Styles Not Generating Thumbnails/Previews

I have File Browser installed on my website. The module info can be found here: https://www.drupal.org/project/file_browser When I go to browse for pictures, there are no images. You can see what I ...
1
vote
5answers
2k views

Media name as link to file

I have a "Document" media bundle, and I have a custom view mode called "Embed". In that view mode, I have removed everything except the media name property and my document file field. For media name ...
3
votes
2answers
3k views

Create a zip file from a list of selected files and make the zipped file downloadable

I have a list of image files. I need to archive those files in zip format and make the archived file downloadable. I have seen ArchiverZip class defined in the system module of Drupal 7. But I couldn'...
1
vote
2answers
238 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 ...
1
vote
2answers
1k views

How to Embedd youtube video in body field (converts URLs into embedded players)? [closed]

Is there a simple way to insert youtube video in body field like other CMS where you copy a youtube link in the article body and it is automatically converted into a video player in front end. I’ve ...
0
votes
0answers
48 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 ...
3
votes
3answers
8k views

How can I get the URL to the public files directory?

I can get the path to the public files directory by using Filesystem::realpath: $path = $filesystem->realpath('public://'); But how can I get the URL of public://?
0
votes
1answer
30 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 ...
1
vote
1answer
211 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 ...
2
votes
0answers
155 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
842 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: $...
0
votes
1answer
42 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
77 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
221 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
217 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
410 views

Problem with restricted download links (hook_file_download)

On my site I have a bunch of files that require logged-in user for download access. Well that's not about just display access, I also want to avoid passing download links around. Having read about ...
0
votes
1answer
120 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(); ...
3
votes
4answers
10k views

Best way to insert video (vimeo and youtube) into content

What is the best way to embed videos into content? Often it's not ideal just to have video content at the beginning or end end of page content. More often then not it something like [text] [video] [...
0
votes
2answers
2k views

File added programaticaly are not deleted when node is deleted

I'm creating a node programmatically with one image field. Nodes are Created without any problem. But if I delete the node the file is marked as "used in 0 place" but never deleted (I run the cron). ...
0
votes
3answers
2k views

Drupal System cron temporary file/folder error

I have very specific problem which I can't resolve. Thing is, I've created few files with function that creates temporary files and then system cron after running should delete them. Problem that I ...
0
votes
1answer
43 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
42 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 ...
2
votes
2answers
2k views

How do I set the private file system path's permissions?

There is an option in Configuration > File system which let you define a path for private files. After setting a path in this field, the access for all users is restricted (including admin). I need ...
2
votes
2answers
2k views

Entity Print Module: Create PDF from HTML

I´m trying to use the entity_print module for generating a PDF in Drupal 8. I want to print out HTML. My module has no entities it gets data from a solr server and generates HTML output. My first ...
2
votes
1answer
132 views

Drupal duplicate filename throws AJAX error

I am using the managed_file in a form to upload a file to Drupal. As you know Drupal saves the name of this file into its database and stores it in the path you give. Unfortunately, when a user ...
0
votes
0answers
61 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
136 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
2answers
92 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
136 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: ...
4
votes
1answer
2k views

How do I hide /sites/default/files from URLs?

I want to upload files to their normal directory under /sites/default/files/. So let's assume I have example.pdf uploaded to sites/sites/default/files/manuals/example.pdf. I want the links to files ...
1
vote
2answers
1k views

How to change path of public files Drupal

Public files in Drupal have a relative path that is similar to /sites/default/files/file.txt; private files have a relative path similar to /sites/default/files/privates and system files have a ...
0
votes
1answer
17 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 ...
8
votes
4answers
2k views

How to make existing public files private?

Let's say I have a node type "Article" which has a field "File" which is set to handle public files. A lot of articles and files get added. Now the specs suddenly change and the "Article" will move ...