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
1
vote
1answer
802 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
213 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
2answers
879 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
52 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
278 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 ...
1
vote
1answer
133 views

Webform2pdf - Message body empty

I'm trying to use webform2pdf to generate a pdf containing form inputs. The form works fine if I don't check "Generate PDF Document", and I receive a confirmation email. If I do enable the PDF, I don'...
1
vote
0answers
63 views

Allow NAS-stored images to be attached to nodes and rendered using image styles? [closed]

What is the process that will allow images stored on a NAS to be attached to nodes that can be rendered with image styles while allowing the file structure on the NAS to be traversed by a Drupal 7 ...
1
vote
1answer
47 views

What linux user accounts should be created prior to Drupal 7 install?

When preparing to install Drupal 7 on a clean linux installation (Centos 7 in my situation), what linux user accounts should be created? I ask this question because I seem to be having problems with ...
1
vote
1answer
208 views

Role level file access control

I have been asked to control access by different groups of users to files uploaded to a website. This covers both files uploaded as a field, and files uploaded via IMCE and CKEditor. I have several ...
0
votes
1answer
49 views

Hiding a <div> in mobile only

I inherited a Drupal site recently that I'm having a bit of trouble with. Essentially, I need to hide a menu in a mobile view, but still remain visible on a desktop. So far, I've added this to my css ...
0
votes
1answer
341 views

Folder and file sharing in Drupal

Here is what I am trying to achieve. I have two roles Teachers and Students. Each teacher has images of answers written by the students in an exam. After checking these papers, teacher takes an image ...
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 ...
0
votes
2answers
1k views

How do I get file ID from node?

How can I get file ID like I got, for instance, file URI: $getFile = $entity->get('field_file')->entity->getFileUri(); I need it to send an email (swiftmailer) $file_one = file_load(1);
1
vote
2answers
327 views

How to fire a Rule after adding a new file in multi-value field?

Working with Drupal 7.56, Rules 2.10, Conditional rules 1.0-beta2 and File Entity 2.4 I can't fire a rule when I add a new image in a multi-value Image field (related to File Entity for inline fields)...
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 ...
2
votes
0answers
677 views

Drupal 8 Private file is accessbile by anonymous user

I have created a content type with file field and set Upload destination is private files. I have also set the $settings['file_private_path'] = '/path/to/private'. But the file is accessible by ...
-1
votes
1answer
25 views

Need a solution to enter more then 100 PDF (or other) documents to one node

My client wants to be able to enter over 100 PDF and other documents to be downloaded from a single node. There will be several nodes like this each with their own linked files. Most of these are ...
5
votes
2answers
4k views

How to do file downloading in a controller function?

I asked the question about downloading of files upon submitting a form. Now I want to clarify how to do it in the case of controller function. That is, some controller is called and its function is ...
1
vote
1answer
2k views

How to download file upon submitting a form?

I have a form with the submit button. And I have a file in '/sites/default/files/tmp/my_doc.docx' I'm trying to download the file upon submitting the form. Here is my code public function submitForm(...
0
votes
1answer
359 views

How do I create a file object from a local file?

I am trying to attach a file in the custom module's directory to every new node created for a content type. How do I create the file object? The following code gives me an error. $uri1 = ...
1
vote
0answers
25 views

Drupal 7 - Custom File links

On my Drupal site, there's a specific type of content with a right panel (Documents), in which I add files (Field Type - file, Widget - file). For that particular type of content, I wanted to change ...
0
votes
1answer
40 views

HTTP/2 does not allows to write in folders in Drupal 7, how can I fix?

I've recently changed from HTTP 1.1 to HTTP/2, as soon as i did it I was not able to create or edit files from backoffice (both image upload or css/js cache), but if I did it from FTP there is no ...
0
votes
1answer
171 views

Create a PDF with one result from a view

I have a view with information from a specific database table and I want users to be able to generate a PDF with the results from one row, which would contain all the information from the row. So far, ...
1
vote
1answer
145 views

Image field file upload issue

I'm using Drupal 8 and paragraphs together, and I've got an image field attached to an image paragraph. When adding content, if I nest this inside of another paragraph (as a paragraph reference field),...
0
votes
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 ...
1
vote
0answers
34 views

Access to private files change after deleting parent node where it was originally attached

I just ran into a situation where access to private files changed after its deleting parent node. I confirmed that anonymous users do not have "View private files" permission. If the node is ...
2
votes
2answers
744 views

how to include .inc files in drupal8 in custom form

I have my custom module in drupal8.I have created a custom form.My form has many fields so i was wanted to move it to .inc files.Please can someone suggest me how and where to include my .inc file.
0
votes
1answer
227 views

Front page returns 403 for unauthorized users

I'm trying to get a D7 staging site's git repo up-to-date with its production server repo. In other words, I changed A LOT of stuff on staging (by running git fetch <branch> && git reset ...
1
vote
1answer
386 views

Can I create a url alias for private files?

Should we be able to add a url_alias (in D8 from /admin/config/search/path) for a private file? Right now it allows me to add an alias (and I can see that it is being rendered in the front end) but it ...
0
votes
1answer
79 views

Create folders in custom installation profile fails when usind drush site-install

I am working on a custom installation profile, and am using $_SERVER['DOCUMENT_ROOT'] as part of creating custom folders inside <drupal-root>/sites/sitename.tld/. It works as expected when using ...
-1
votes
1answer
205 views

File browser error - IMCE

IMCE - http://ufku.com/drupal/imce/7 I am trying to load file browser window via IMCE module on CHOOSE FILE button-(form upload field) click. My following code loads such window fine from which I ...
-1
votes
2answers
165 views

File upload form element that will allow the user to select files from server [closed]

I want to achieve (Create a form that will allow the user to select files from server) in Drupal 8.3 and have followed steps 1 to 4 but for some reason it's not working at my end. Can someone shed ...
0
votes
0answers
602 views

How to embed generic file media entities?

I'm using modules Media entity and Entity embed and Entity Browser, which all work fine for images and video. Now I'd like to use the Media framework to also manage some PDF and other non-image ...
4
votes
1answer
1k views

Problem with dependency injection (File::load and \Drupal::service)

In order to make a managed_file field permanent I did this in my module configuration form: <?php namespace Drupal\my_module\Form; use Drupal\Core\Form\ConfigFormBase; use Drupal\Core\Form\...
0
votes
1answer
54 views

File always save with underscore

I have a custom form where admin users upload a CSV file. Everything is working fine, but the file is saved with an underscore. For example, I upload callLog4127_Lorem_20170701.csv but the file is ...
0
votes
1answer
599 views

Field formatter only displays file name not link to file

I installed Drupal 8.3.5, no extra plugins or themes. I have added in the "base page" (structure/type) a field (file_in) to upload files. If I add a new page (node/add/page) and also load a file in ...
-2
votes
1answer
29 views

An admin-friendly approach to establishing a permissions relationship between a file group and a user

The need is that when a new client project begins, that the client be given a username and password and have access to a specific piece of content that, in turn, gives access to download files, ...
-1
votes
1answer
357 views

Can I stop Drupal from trying to get file size from URLs when saving files?

Saving a Drupal file with an S3 URL results in a watchdog message like this: PHP Warning: filesize(): stat failed for https://s3.amazonaws.com/[…] This happens because Drupal 7's file_save() runs ...
1
vote
1answer
799 views

temporary://fileh4Oxvi could not be copied, because the destination directory is not properly configured

I am using Advagg and Amazons3 Module, which is causing this error: temporary://fileh4Oxvi could not be copied, because the destination directory is not properly configured. Files are getting ...
3
votes
3answers
2k views

how to rename file before/after upload

I want to rename an up-loaded file. I have the following code. I have defined a submit handler to do so. function example_form_submit(&$form, FormStateInterface $form_state) { if ($form_state-...
0
votes
2answers
91 views

I'm getting errors from trying to upload images from 2 different fields, server or module issue?

Using Drupal 7 and Siteground hosting, when I try to upload images at registration I get this error, but randomly. An unrecoverable error occurred. The uploaded file likely exceeded the maximum ...
0
votes
1answer
115 views

file_unmanaged_copy - Any service alternatives?

The functionality of the file_unmanaged_copy is exactly what I need. The only problem is: it's a global function which uses static service calls. Since I need to unit test my class (and not to mention ...
0
votes
1answer
28 views

File (Field) Paths get year only

I've recently found and started using the File Fields Path module in Drupal 7 and I have a date field that I'm only collecting the year from. Using that in the file path part of the module, it ...
0
votes
2answers
498 views

How to save file to different server?

I want to specify a different file system remote server path. So that if I upload a file then this should be served from different remote server. I am using Drupal version 8.
0
votes
0answers
382 views

Add a download link to menu

I am trying to add a link to a managed pdf file to the footer menu. Right now I am using a controller which uses a specific route in order to download the file: // src/Controller/DownloadController....
-1
votes
1answer
51 views

Multiple file uploads

I am uploading multiple files using Drupal's form API but I am doing it multiple times: $form['upload-group']['data-sources'] = array( '#type' => 'file', '#name' => '...
0
votes
1answer
108 views

Remove paper size options on node add forms

Node add forms show some paper size options no matter who the user is, even regular authenticated users. It seems to be part of the Printer, email and PDF versions module. I added the following code ...
0
votes
0answers
359 views

How can I store an uploaded file in custom module folder itself in Drupal8?

I am having one requirement to upload a file and store it in that module folder itself. I am just wondering how to do that. I have created a custom module with File type form element in that as below. ...
1
vote
1answer
2k views

Remove uploaded files before the 6 hours cron?

I have a custom Content Entity in wich definition there is a 'file' field. The file widget works fine. The 'Browse' button allows to select a file and uploads it to the proper server directory and the ...
0
votes
0answers
28 views

How can a theme be looked in sites/my_custom_website?

How do tell Drupal 8 to look for themes and custom modules in a directory called sites/my_custom_website? I know this type of code is added to the themes and modules directory at the root level. I ...