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

Can't load library path files

I have added a library to the libraries folder. I have the Libraries API module installed and I wrote this code: function my_module_libraries_info() { $libraries['google-api-php-client'] = array( ...
0
votes
1answer
360 views

Problem with swfobject_api or jwplayer module in Drupal

I have a problem with swfobject_api or jwplayer module. When I use this code in node.tpl.php everything is fine. $config='sample'; $flashVars=array( 'file' => 'path to flv' ); print theme('...
0
votes
1answer
362 views

Custom feed tamper plugin to convert an image GUID into a URI

I have a feed importer for image files, which stores a column in my source csv as the GUID of the final files in Drupal. I also have another importer for, say, articles. In the articles csv, there is ...
0
votes
1answer
388 views

Move file uploads in webform into subdirectory using hook_webform_submission_presave

I'm using the webform_multiple_file module to let users upload files in a webform. There is a second form component in that form. It's a number. I want to change the upload directory, which is defined ...
0
votes
1answer
411 views

Preview is not showing after upload

When i am trying to upload image as a Authenticate user, After upload i am not able to see preview. fields got disappear fully. If i try to do as a admin, i am able to see that. Any suggestions?
3
votes
3answers
7k 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://?
10
votes
2answers
8k views

How to get the url of a file field of a given node?

$node->field_file gives me a FileFieldItemList while the first entry seems to be a FileItem. $node->field_file->getValue() gives me an integer (I guess the file id). How can I actually get ...
1
vote
1answer
366 views

Strip overlay context from File field

I have a basic File field set up to allow my users to attach files to nodes. However, the File field widget in the node edit form displays files as a link to the file, and the URL contains #overlay-...
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 ...
1
vote
1answer
182 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
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
307 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
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
42 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
76 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
82 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
408 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
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(); ...
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
3answers
453 views

How to specify the correct private file path in a block

I have a Drupal site at http://example.org/xyz Per the instructions here, I have set up a private file directory outside the web root. So let's say the web root is at /home/public_html/example/xyz ...
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
1k 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
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
37 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
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
56 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
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
49 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
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 ...
5
votes
4answers
1k 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 ...
0
votes
0answers
45 views

migrate file path when migrating file/image fields

When I do the initial file migration from my old Drupal 7 site, my source file paths are respected and maintained when copied to my new fresh Drupal 8 site. In other words, inside the 'sites/default/...
2
votes
2answers
246 views

Uploading files to two separate locations

I'm uploading a clients website early next week and they've just informed me that they use load balancing software to distribute over two servers. Normally this wouldn't be an issue because content ...
2
votes
0answers
184 views

How can I change the file saving process to wait until file changes have been synchronized on all servers?

We have a site load balanced behind three servers, and we are using lsync and csync2 to replicate file changes across the servers. In the past we used a GFS system to handle this, which worked great ...
0
votes
1answer
68 views

Menus, drush uli link, and some images not working after moving site to localhost

I've just gotten a site I'm supposed to do some work on but I'm having trouble with migrating to a local development environment. I don't have admin access to the site itself, but I do have access to ...
0
votes
1answer
32 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. ...
0
votes
0answers
965 views

Why does managed_file not respect the #upload_location?

I've got a managed_file, with an #upload_location set to 'public://uploads'. When I upload files using the managed_file form element, uploaded files get copied to the 'public://' root, but not the ...
0
votes
1answer
1k views

Can't get data from drupal_http_request result

I'm requesting a zip file from a remote location, and I'm getting some strange affects here. Here is a snippet: $result = drupal_http_request($serviceUrl, $options); $file = $result->data; ...
2
votes
2answers
2k views

how to make fewer http requests

I'm use YSlow to optimize my web pages it says: This page has 34 external Javascript scripts. Try combining them into one. This page has 5 external stylesheets. Try combining them into one. but all I ...
-1
votes
2answers
269 views

embed photo album hosted on flickr.com using flickr module not showing photo album

I am attempting to use the Flickr module flickr-8.x-1.0-alpha2 along with Flickr API and Colorbox module to display a album of recent photos from Flickr.com. I have setup the API keys. and added ...
2
votes
1answer
329 views

When adding media to content, how can I search for the media by tag or term?

In Drupal 8, I created a new Media type "PDF Files." I have imported almost 30,000 of them, each complete with Title (Name), file, and the taxonomy that categorizes them. On the content type (Let's ...
0
votes
2answers
381 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 ...
0
votes
1answer
21 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 ...
0
votes
0answers
86 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 ...