Questions tagged [files]

Use it to generally reference to those files used on websites which could be video, images, pdfs, etc.

0
votes
1answer
548 views

403 forbidden error when loading images in test server

Am working with drupal7.When images are loading below error is showing in my test site console: GET sites/default/files/styles/slideshow_full/public/plans/30989/main-image/...
0
votes
1answer
127 views

PDF Preview module not working in ubuntu for Drupal 8.5 version

PDF Preview module not creating the image(first page of PDF) in docker (Ubuntu) for Drupal 8.5 version. I have installed imagick(configured the exce path in imagetoolkit module) and Ghostscript and ...
0
votes
2answers
444 views

Change the name of uploaded file based on content type and entity id

Consider this pattern : [content type]-[entity ID].[file:ffp-extension-original] is there any hook so I can change the uploaded file name based on content type and node ID in drupal 8? PS: I ...
1
vote
1answer
98 views

Download all files attached on a site

I have researched a little bit and I haven't found a sound solution to downloading all attached files from all content types across an entire site in an single action. I have found a couple modules ...
1
vote
1answer
20 views

Can I check a file's properties before saving it with system_retrieve_file?

My understanding of system_retrieve_file is that it saves the file temporarily first. Is it possible to check this file and if it passes, then save it? I've only used this function like below. $...
1
vote
1answer
181 views

How to recalculate uploaded files' sizes in KB and update the values in the database?

I use a shell command to look for all uploaded JPEG files above 500 K.B. (originals) and do JPEG compression on them. They get smaller in size, but Drupal still shows the originally uploaded file size....
1
vote
1answer
109 views

modify file object so it is marked as permanent [closed]

in a custom drupal 8 module, I used file_save_data which programmatically creates file object. But doesn’t have an option to create it permanently. I can view the file object in the UI after ...
0
votes
2answers
465 views

file_save_data doesn't save image

I'm using Drupal 7.56.. I want to upload images from other urls.. I use: $image_original_path = '.. here my original path..'; $my_destination = 'sites/default/files/images/'; $my_new_name = 'my_image....
0
votes
0answers
51 views

Image not getting rendered Drupal 8

I am using Drupal Private File System. Everything seems to be working fine with the upload, pdf and video are properly getting uploaded and rendered. But in case of image upload, I am getting 16*16 ...
0
votes
1answer
203 views

Can't get fid of the saved file after file_save_data

I have been trying to get the fid of the file which my custom module is saving and every time I end up getting the error "Trying to get property of non-object in report()". I have tried file_object->...
0
votes
1answer
1k views

Display the size and format of a file attached to an article

I'm trying to display the format and size of a file attached to an article. Its system name is field_file. So far, I've succeeded to load an article in my my_theme.theme file and the field_file ...
1
vote
1answer
255 views

AJAX 500 using In Place Editor to upload managed_file image

I have a plugin that allows the user to upload an image using managed_file to use as a bg image. While using the In-Place editor, I get a Ajax 500 error when trying to upload. I will post my watchdog ...
0
votes
1answer
327 views

Image styles are not created 404 Not Found

I'm running on Nginx. All permissions are set to 777 and owner is www-data:www-data. Create/edit a node with image_field, upload an image. Original image is uploaded and stored at sites/default/files/...
0
votes
1answer
245 views

Let custom module access private files via file_get_contents

I have a custom module (Drupal 7) where I want to read the contents of a file using file_get_contents($file) in the private directory. Theres a access denied error, as the module accesses as anonymous....
0
votes
1answer
139 views

What hook should I use to alter the File Upload field in Webform 7.x-4.16

In Drupal 7 Webform file field, might there be a way to access the link provided after the a file is uploaded? The reason is that we have a hot-folder/watch-folder process that runs, cleans a file, ...
0
votes
1answer
556 views

RewriteRule causing internal redirect limit error

I am trying to server a static HTML site from /sites/default/files/staticsite and make it available via a subdomain. I'm hosting the site on Acquia Cloud, and their docs describe Maintaining a static ...
0
votes
1answer
154 views

Downloading from private directory corrupting some file types

We have set up a private file system on a website based on drupal's guidelines. We are using Drupal 8. We have setup the private file directory outsite of /var/www at /var/privatefiles. When ...
0
votes
2answers
1k views

CKEditor and IMCE: how to access to public files directory

I have a problem that I can't access public files directory from IMCE as file browser (and CKEDITOR as editor). When an user write a blog post, he can't upload images to public directory because this ...
1
vote
1answer
675 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 ...
-1
votes
1answer
384 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
244 views

Download true file name instead of from drupal version changed filename

i have some file upload fields which works great. the file is stored on public file system and will be able to get downloaded from the users (in a specific node). the issue is when i update the file (...
2
votes
3answers
3k 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
2answers
107 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
322 views

Document viewer for the uploaded files

I had been using a module called "filebrowser" for implementing the file management system. This provides with a content type "Directory Listing" (listing all the uploaded files) through which a node ...
1
vote
1answer
865 views

How do I delete files attached with media entity in drupal 8.4.2?

Background: drupal 8.4.2 custom media solution Issue I can not delete files permanently which created as media entity. Reproduce Created an image media entity. /admin/content/files claims status ...
0
votes
0answers
22 views

Why am I seeing so many duplicate images in my thumnails folders?

Why am I seeing tons of duplicate images in my sites/default/files/data_export_import/styles/test_thumbnails There are so many in there, like 4 gigs, I'm going over quota, how can I clear this and ...
1
vote
0answers
134 views

How to get all the image files and clean them up on Drupal 8?

On my Drupal 8 website I have created multiple media contents and uploaded image file to each content. When I update new image of a media content, the old image file remains unused in the image ...
2
votes
1answer
142 views

PHPUnitTest is missing the file_managed table?

My PHPUnit test is throwing an error saying that my file_managed test database table does not exist. What module do I need to include for that test table to get created? I would think it should be the ...
3
votes
0answers
73 views

How do I use hook_entity_access() to let anonymous users upload private files?

I have same issue described in How to skip the ReferenceAccess constraint on a file upload by an anonymous user? So I need to use hook_entity_access() or hook_ENTITY_TYPE_access() to solve the issue. ...
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 ...
1
vote
0answers
468 views

What permissions should I set in Drupal core files?

I get a very long message when flushing the caches, starting with Warning: unlink(/[my-website]/sites/default/files/css/css_mXyk_ET1j0oQS97qAccqHtOxn-21f8f9PeabB5s5OTE.css.gz): Permission denied in ...
1
vote
0answers
55 views

File value is NULL in custom file field type

I am creating a Custom field type for "file upload" functionality that contains a File form. This is the code I am using. /** * Plugin implementation of the 'AkamaiUpload' field type. * * @...
0
votes
1answer
774 views

How to change default file system path in D8?

In D8, where to change the Public File System Path to be : sites/default/files/[nodeID]/ Do I need write a module?
0
votes
1answer
41 views

Saving File Space with Drupal 8

I have a hosting account which has a maximum of 250 MB total space. I have installed Drupal 8 and I'm using the bootstrap theme and already my host has warned me that I am nearing my limit for file ...
-1
votes
1answer
238 views

Files inside styles gives a 403 error

I accidentally changed the permissions of sites/default/files folder to 777, but later I changed back to 755. From that moment images in the articles are not showing. It's giving 403 forbidden error. ...
1
vote
0answers
209 views

Drupal 8 : Serving private files using nginx and X-Accel-Redirect [closed]

We're using private files on a site which is working quite fine. The problem is that if an author uploads private videos which have like 10 minutes length the php worker does not shut down until the ...
0
votes
1answer
286 views

Anonymous users can't access to image style field

Entity Type : block Field : 'Reference to entity : image style' (field_image_style) Manage display : I display the Entity ID Twig In my twig template, I get the field_image_style data from content....
-1
votes
1answer
48 views

How can I create a custom module that allows multiple image upload fields?

To be a little more specific, I am trying to create a custom field which will contain 4 images and 4 corresponding paragraphs. The part that I am having issues with is allowing 4 image upload fields.
2
votes
1answer
668 views

Load a media entity/object from a fid?

I have the file ID (fid), and the rest of the file object. I need to get fields from the parent media entity, but I can't find anything about loading a media entity from a file object. Drupal 8.4.0 ...
0
votes
3answers
444 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 ...
1
vote
1answer
224 views

How to migrate files together with additional fields

In my Drupal 8.4 installation I use the module File Entity. In the module are defined a few additional fields: 'author', 'title', 'alt',... My migration works. The files are imported, but the ...
4
votes
0answers
263 views

Image styles are not generated in Docker for Windows

When I open in browser http://localhost:1567/sites/default/files/styles/thumbnail/public/2017-10/478069720_1384178114_4.jpg, I see 404. The "original" images are uploaded successfully, and the ...
0
votes
1answer
18 views

File (Field) Paths upload/remove not recognized

This behavior started after upgrading our Drupal 7.43 system to 7.56. In the process we also upgraded the Views module to 7.x-3.18 and the File (Field) Path module is at 7.x-1.0. In the content type ...
0
votes
2answers
79 views

Generate file path for created file so it can be downloaded

I'm writing a module based on this Jeff Geerling post that will allow the user to use a form to select some data, and then use the Batch API to generate a large .csv file with the desired data and ...
0
votes
1answer
149 views

Only allow specific roles to upload specific extension files

How do I restrict users with specific roles to upload files with specific extensions on node edit pages. On my site I have two specific roles editor and animator. Conditions are: Editors can only ...
1
vote
1answer
760 views

Private file folder outside document root

I am setting up a private files folder outside of www. I have set the permissions to allow access to the folder by www-data to read and write but not execute, however, my drupal 8 site is now showing ...
1
vote
1answer
186 views

User can't access own private files via Views

I've set up a private directory sites/default/files/private and use it for a file field. As an admin, everything works as expected when uploading and viewing a private file. As a user who uploads ...
0
votes
1answer
792 views

Private file system, The upload directory private://webform/XXXX/_sid_ for the file field could not be created or is not accessible

I am trying to set up the private file system for drupal 8. I have created a private folder /home/user/public_html/private_files with permissions set to 777 in settings.php i uncommented the $...
0
votes
2answers
49 views

What is the best procedure to upload sites folder from Locahost to live server? [closed]

I've had problems on and off with executing this task, using D7. I create sites on localhost , then I ftp the files to live server. FTPing the whole sites folder doesn't work, sometimes causes ...
1
vote
0answers
260 views

How do I display the file size of attachments on a node templates?

Is there any way to display the file size of attachments on a node through the node template programmatically? I read How do I display the attachment's file size of a node? but it seems that the ...