Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [files]

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

1
vote
1answer
116 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
93 views

When setting up the Drupal 7 database (mySql/mariadb) what database user accounts should be created?

When installing the database (mariadb) for use with Drupal 7 on Centos 7, what database admin and user accounts should be created and with what permissions? Do specific directory permissions or file ...
1
vote
1answer
42 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
189 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
315 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
301 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
1k 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
654 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 ...
3
votes
2answers
3k 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
204 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
38 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
147 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
125 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
2k 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
32 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 ...
1
vote
2answers
676 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
175 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
333 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
77 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
188 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 ...
0
votes
2answers
142 views

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

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
567 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
50 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
584 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
320 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
740 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
80 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
104 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
27 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
1answer
459 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
345 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
47 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
103 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
318 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
1k views

how to 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 ...
0
votes
1answer
568 views

Unresolved dependency File Entity error

I'm trying to run a serious of updates on Drupal. However, I'm seeing to be running into the following error: Unresolved dependency File Entity (Version >7.x-2.0 required) Media requires this ...
0
votes
1answer
27 views

Allow different users to upload pdf to nodes privately

I am trying to build a question answer site in drupal 7. User with teacher role will create a question node, after that users with student role can upload answers in PDF. Different students can upload/...
-1
votes
1answer
472 views

How to Upload images and show in html tables?

Programers. I have some question to ask: (1)I have create a form to upload image file, the files is located in "public://images".This is my buildForm. public function buildForm(array $form, ...
0
votes
1answer
64 views

Is it possible to convert separate (matching) managed files to a single shared file?

I'm finishing up a Commerce store that has tens of thousands of imported products. In a slightly simplified form, here's my problem: Each has a unique primary image and a common secondary image. The ...