Questions tagged [files]

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

4
votes
1answer
421 views

How do I set permissions for a subdirectory that Drupal creates when uploading a file?

I'm using Drupal 8 and the Flysystem module to configure remote file storage via SFTP. My question probably applies in general, though. When a file is uploaded, and the file directory setting has a ...
0
votes
1answer
12 views

500 error on one page in entire site only showing error “You are here” instead of administration content

this error seems to only affect one page in on the website, and nowhere else. Here is what it looks like: The watchdog reports do not show the issue, and I believe it to be a permission error or ...
0
votes
0answers
18 views

Why is my user getting logged out before reaching hook_file_download()

I'm having problems where my logged-in users are trying to access a file (in private file area) but when they get to the hook_file_download() function of my module, they are coming through as user 0, ...
-1
votes
2answers
260 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 ...
0
votes
1answer
24 views

Features 8.x-3.7 not writable on Window's Ubuntu

8x-3.7 features, most stable version, but I am having trouble writing to custom module on the UI. My structure is as follow: -modules/ contrib/ features/ custom/ news_blogs/ ...
1
vote
0answers
61 views

Use Filename for File entity Page and Window title

Drupal 8 file entity full display mode apparently uses the word 'File' for both page title and window title. Yuck. I've reviewed the various answers on this question, but I'm not seeing a definitive ...
1
vote
0answers
263 views

Google invisible recaptcha doesn't work with form file fields

I have a form in my drupal project which has a managed_file field. It worked perfectly until I added invisible recaptcha for the forms. The file is getting uploaded but when I submit the form the ...
0
votes
2answers
125 views

How can I get the uploaded file path of a contact form in drupal 8

I'm using the hook_mail_alter() to create a custom email for contact forms. I was able to get the fields labels and values and use a twig template to send the email. Most of it is working just fine, ...
1
vote
1answer
33 views

How to restrict users of other roles from seeing the site administrator details?

I have created a role called "Site Admin" and created a user with that role. When i log in with that username. "People" menu is showing in toolbar only when we give "adminster user" permissions to ...
0
votes
1answer
688 views

How to open file in new tab instead of download when submitting form?

The code below downloads the current file, I need it to open the file in a new tab, what needs to be added in order to do so? public function submitForm(array &$form, FormStateInterface $...
0
votes
4answers
2k views

How to set up permissions for the private files directory?

I'm trying to set up the private files directory and I'm getting the following error. The backup file could not be saved to 'private://backup_migrate/' because the directory could not be created ...
0
votes
0answers
175 views

Drupal 7 AJAX not working on entire site

Images upload, Views Submit (Ex. Global: Text area, edit fields in Views) are not working in my Drupal 7 website. Here is the access log I found from Apache; 127.0.0.1 - - [19/Jul/2018:12:46:51 +...
0
votes
0answers
23 views

Not seeing file upload destination radios for image field in custom blocks. Where is the fault?

Scratching my head with this. I am working with a custom block and have added an image field. However the Upload destination radios are not present and this results in a file storage error. ' Illegal ...
0
votes
1answer
20 views

Site is redirecting to old domain on button submission, files are linking to old domain [closed]

I have a D7 site at www.example.com, an old one, not updated since 2012 (Drupal version 7.34). I made a clone copy with separate clone database under dev.example.com All files like CSS are still ...
0
votes
0answers
10 views

Form field API download field?

I have a form where user can upload a CSV file to import some data, the thing I want to do is add a field where the user can download an example of csv to create is own. The form I create is made ...
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
26 views

I cannot delete a file field from node

D7 content type with file field. On edit page, displays attachment(s) with Remove button, but cannot remove. Get blue "spinner" for a few seconds. Also issue with upload of file field. Upload action ...
0
votes
0answers
27 views

Referring two file systems in a single site

I have production and staging environment that use the same file system (Amazon S3). I need to change the user profile picture saving path of my staging environment to local file system and other ...
0
votes
1answer
268 views

File upload error. Could not

I have Drupal 8.4 running on Windows Server 2016, and when trying to use an upload field on a content type I get this error The file phpC128.tmp could not be saved. An unknown error has occurred. ...
0
votes
1answer
140 views

Adding a file download link to a node

I have a content type recipe and for each recipe type content I want to add a link which can download the recipe for the user. How can this be done in Drupal 8.5.2? I'm not sure if I should provide ...
1
vote
1answer
47 views

How do I manually configure the Link module?

I would like to be able to add the file:// protocol to the list of filter_protocols so that we can add links to shared company files on a mapped drive from within our intranet website, but I'm not ...
1
vote
1answer
27 views

Nodes display links to shared document(s)

Summary Nodes display links to shared document(s) Example PDFs to upload only once before I create the workshops: Booking Form Primary School Booking Form Secondary Schoool Risk Assessment for ...
7
votes
1answer
2k views

Load a file entity by URI

Is there a way to load a file by URI in Drupal 8? In Drupal 7 it is possible by the next example: $uri = 'public://file.xyz'; // Take a look at: file.inc::file_load_multiple $files = ...
0
votes
1answer
42 views

Add state permissions and allow state changes

I'm using Workflow module. I want to give permission to a specific role to edit the content moderation state. I found these on permissions page but it's not working. After I update the role permission,...
0
votes
0answers
36 views

What's the best files and directories permission for shared hosting [duplicate]

i'm using a shared hosting for my Drupal Website and I'm having some security troubles especially with folders and files permissions. So after some researches in the official documentation and some ...
3
votes
1answer
594 views

How do you upload an image via jsonapi?

The documentation is vague: https://www.drupal.org/docs/8/modules/json-api/working-with-files-post I am trying to upload an image following the sample code given for uploading a "document" on above ...
0
votes
1answer
198 views

Migrate Alt and Title text from a D6 image file field to D8

I'm trying to migrate a multi-value D6 image field to D8. I've already migrated the files with d6_file and it worked. When I do the node migration with the image field works and I get all the values ...
2
votes
1answer
314 views

How to allow any file extension (or use a blacklist instead of a whitelist) for file fields in Drupal 8?

For a file field, it’s required to enter file extensions in "Allowed file extensions". Is there a way to allow any file extension? Or a way to switch from a whitelist to a blacklist? What I found ...
1
vote
1answer
65 views

How to Add Existing File to file_managed. File is Blank

I have manually added some files to the Private Files directory on my Drupal 7 site and wish to add them to the file_managed table in the database. This is what I have attempted: Load the existing ...
0
votes
1answer
83 views

Access image/file with REST and Basic Authentication

I'm trying to access images/files in Drupal 8 through REST. They are only accessible for authorized users. I'm able to get the URL to the files, but when I try to load them using Basic Authentication, ...
3
votes
2answers
1k views

Protect drupal code injection from url

Recently my drupal site is hacked. When i see website log from drupal admin panel someone trying to inject code from url. I searched my website(drupal) directory lots of code in page appended and new ...
0
votes
1answer
251 views

View of attached files to a node

I use D8 Editor File upload to add files to a node. But i want an overall view from all the files in that node, but only in that node. I can create a view for all the files but i can't filter on the ...
1
vote
0answers
38 views

Private files works on one site but not another

I have two sites on the same machine - demo and dev. They are served from their respective home directories. I've set up private files on both. All the settings seem to be exactly the same. However, ...
0
votes
0answers
29 views

Drupal directory permissions in Dev server with git pull access to co-developers [duplicate]

What is the ideal Drupal directory permissions that is secure and that gives access to multiple developers to git pull/push? I was the only developer/maintainer for a website and the Drupal dir was ...
1
vote
0answers
230 views

Automatically overwrite existing file, and keep same filename when uploading new.

I am building a site with D8, where I have a content type 'user' where among other fields, I have two 'file' fields where users will be uploading their CVs (one for english, one for greek language). ...
1
vote
1answer
52 views

How to fire a Rule when an image is removed from Image field with unlimited values?

Working with Drupal 7.58 and File Entity 2.19 and Rules 2.10 First I needed to fire a rule when saving a new file and I found a solution (here). Now I would like to fire a rule when an user removes ...
0
votes
2answers
24 views

Reference a filename in form validation for an image

I am new to Drupal and am making a module to alter a content type. I have a content type that allows a user to submit an email and an image and I want to change the filename of the image to the email ...
0
votes
0answers
47 views

How to write a file in themes folder?

How can I write data to file in themes folders? I am getting the following error. Directory permissions are drwxrwxr--. temporary://fileOFwrpn could not be moved/copied because the destination ...
0
votes
0answers
23 views

Entity Reference Error when uploading profile picture

We are getting the following error when uploading a profile picture as an authenticated user. Drupal Version is 8.5.1. Its working fine for admin users. We don't have any permission modules installed ...
-1
votes
1answer
308 views

How do I display file and description field when multiple files are uploaded in a view?

I am using Field Collection module to display title and files all together. When I upload multiple files, the description field for each file is enabled, but it is replacing the uploaded filename. ...
0
votes
2answers
41 views

Link to download pdf from webform email

I have created a webform, after the submession the customer is sent the registration confirmation e-mail. How do I include in this email a link to download a pdf ?
0
votes
0answers
121 views

How to control (rename) filename of uploaded file

I am building a site for my school. Teachers will be able to upload their CVs. Their files will be PDFs and I need to have them in two languages (English and Greek). So I have a File field type ...
0
votes
1answer
1k views

The directory tmp does not exist and could not be created

I keep getting this error since updating to Drupal 7.5.8 and cannot get rid of it regardless of trying all I know. Even adding it / copying-pasting the previous tmp dir or changing the tmp file name (...
1
vote
1answer
37 views

How to add files using rules module?

This question follows Override webform module submit Based on this answer, I used the rules module to create a node after webform submissions. My webform contains an <input type="file" /> for ...
2
votes
2answers
279 views

The path admin/content/files is missing in Drupal 8.5

I have installed Drupal 8.5 and today I realised that the tab admin/content/files is missing. Thanks to my backups I realized that this tab link is already missing since the 14th of March. Prior to ...
0
votes
0answers
42 views

7 Unable to use file_usage_add when adding new content (node id doesn't yet exist)

I have a custom widget with custom field definitions. I am using hook_widget_form to create my fields, and I am attached a custom validation function using the #element_validate property on a fieldset ...
0
votes
0answers
37 views

Files folder changes permissions randomly

It seems that the sites/default/files folder of a project looses the permissions from time to time - and I have no idea how it comes. Suddenly error logs appear stating that the public files folder ...
0
votes
1answer
29 views

Trouble recreating my site locally

My online site gives "server encountered an unexpected error" and the shared hosting site (1and1) gives no log access. So I am trying to recreate my site at home. I started with a clean install of D8....
0
votes
1answer
73 views

How do I add updated timestamp to a file url to ensure people download the latest version?

I'd like to add the last updated timestamp to the uploaded file name e.g. my.pdf?ver=123413414 The file is uploaded on a regular basis and I'd like people to access the latest version. I can't see ...
0
votes
1answer
670 views

How can I override template_preprocess_file_link function?

I want to print file size near file link in file-link.html.twig template. To do so I need something like {{ filesize }} variable avaiable in template. I tried to override ...