Static files used on websites which could be video, images, pdfs etc.

learn more… | top users | synonyms

0
votes
1answer
11 views

How can I save a file in specific folder?

I want to upload files to specific folders. How can I achieve this programatically. How can I modify below code such that upload_location should be dynamic. $form['document'] = array( '#type' ...
0
votes
1answer
15 views

weird error - failed to open stream - .module file in theme path?

I am just editing empty template, creating regions and so on. After I first time cleared cache weird error started to appear at every cache clearing: Warning: include_once(C:\xampp\htdocs\...
0
votes
1answer
22 views

How to change a file field value with entity_metadata_wrapper

I need to remove a file field value, and instead, assign a new value to it. The file field contains video and the new video is in the videos directory. This is my code to delete a file field value (...
0
votes
0answers
24 views

Alter form for a translated file field

We are building up a Drupal 7 multilanguage website, using a mixed approach Content and Entity translation. Nodes are content-translated, nodes images are almost shared among languages. We use File ...
1
vote
2answers
89 views

Images referring wrong path

I uploaded some images in content. the images are uploaded to "sites/default/files". but in node page the images are referring "sites/default/files/styles/large" path. how to change it?
0
votes
1answer
31 views

Save a Drupal managed file with cURL

I want to save a managed file from an external site. Previously, I've used this code: $managed = TRUE; // Whether or not to create a Drupal file record $image_file = system_retrieve_file($product['...
0
votes
0answers
12 views

How can i prevent form submission when a file is being removed or uploaded?

I have a node form for my custom content type. There is file field in that content type. And i want to prevent form submission when a file is being removed and uploaded. Note: File removed and ...
4
votes
3answers
124 views

Is there a list of file/image field subtokens?

Token browser does not show the options for file properties. [node:file-field:0:file:url] gets the url, but is there a list of all file options? Or is there a way to check it from sourcecode somehow? ...
0
votes
0answers
4 views

Using Commerce Feeds module, commerce file names are being changed when importing

I have an e-commerce site that sells albums. This product variation type of album has a field of type commerce file. It’s configured to have multiple files (mp3’s) attached, or bundled to it. I’m ...
1
vote
1answer
67 views

How to implement one click upload?

Drupal 8 supports multiple file upload, however the native interface requires three steps: Select one or more files Click Upload Click Save Ideally this could be simplified to a single step i.e. ...
2
votes
1answer
28 views

How to dynamically change the path to store commerce files depending on some product variables?

All my Drupal Commerce files are being saved in the same directory on the server. I have a Commerce product variation of type of album. Each album contains multiple Commerce files (mp3’s, m4a’s). I ...
0
votes
0answers
48 views

Bad error handling of .pdf files against all other file types when a file exceeds the maximum file size

I have a file field with the following allowed file extensions: txt, pdf, doc, docx, zip The Maximum upload size is set via my php.ini and it is upload_max_filesize = 2M 1. While I'm trying to ...
1
vote
0answers
11 views

Add a link to Large Filetype Icon

I'm using the media module for displaying files. I have PDF Preview set up, which falls back to the image formatter, and then Large Filetype Icon. PDF Preview and the Image formatter are set up to ...
0
votes
1answer
4 views

Add on domain does not have access to “../privatefiles” at public_html level

I have a Drupal site that accepts private file uploads from some authenticated users. The directory where those files are stored is privatefiles and it is located above the www directory, at the same ...
0
votes
1answer
36 views

How to load CSS files located outside Drupal's path from within a custom module?

I need to store my css files at a location outside Drupal's path (e.g. /srv/assets/css/my_site/general.css). I attempt to achieve this using drupal_add_css but the browser loads them from: http://www....
1
vote
0answers
18 views

How to programmatically populate FileEntity

I have a file entity with some custom fields, for example a date field. How can I programmatically set the field values? If I, for example, set date-field value with a DrupalDateTime object, I get an ...
1
vote
0answers
19 views

How to set destination URI when migrating files

I have the following case: I'm trying to migrate Drupal 6 profile pictures into Drupal 8 file_managed table. All goes fine except that I'm unable to set new destination URI for column file_managed.uri....
0
votes
0answers
52 views

Recommended file permissions for Drupal 8

In continuation to https://www.drupal.org/node/244924 which is for Drupal 7, is there a script which sets the right permissions for Drupal 8. On the same lines I was thinking how can we take care of ...
0
votes
0answers
9 views

Conditional 'link' field text using Conditional Views module

I have installed the Conditional Views module, but can't quite understand how to use it to get my desired result. I have a field 'asset type' and the default link field ([view_node]). I would like ...
1
vote
1answer
12 views

Get URL of Views 'file' field

How can I get just the url of the uploaded file from the Views module 'file' field. If I do the following: print $view->render_field('field_url', $id); I get the entire 'file' object in html ...
0
votes
1answer
11 views

IMCE module: list only image files

I have a Drupal 7 with the IMCE module installed. It works good but it shows me every files in my media directory. I need to limit the listing to only image files, for example to only jpg, png and ...
1
vote
0answers
41 views

How to define a custom “node add” & “node edit” forms with ajax based fields (file fields)?

I created a custom "node add" & "node edit" forms, everything work well except with ajax fields (I noticed the issue with file fields and image fields). When I try to upload files on my custom ...
0
votes
0answers
16 views

Images of some content types disappeared

I have something strange going on on one of my drupal installation. It seem's that for two content types all the images got unlinked from the existing entities. I can still see in the table ...
1
vote
0answers
34 views

Upload to private directory [closed]

I'm trying to setup a private folder for part of the files I need to make available in my Drupal 8 install and I'm having some trouble. My public files are being served with no problem in sites/...
0
votes
1answer
12 views

Server Error 500 - Edit Tab of Managing Custom Fields of Custom Content Types

Alright, I've got a very irritating error with my site. Whenever I try and Edit a file or image field I get what appears to be a half-loaded page (see image below) I have check an error log and have ...
0
votes
1answer
19 views

Two Errors Lumped Into One - File Field Deleted - Cannot Be Found/Deleted/Recreated

I'm in the process of adding more content types/cleaning up old ones on my site. Except I keep coming across an error that has another part which seems to differ from other questions posted to this ...
1
vote
0answers
27 views

Add validator and description to file upload form

I want to check the min width of a picture when using the file upload form (file_entity_add_upload). normally I would do function my_module_form_file_entity_add_upload_alter(&$form, &$...
1
vote
0answers
17 views

File association With node in drupal of already uploaded file using Services

I created a file on drupal service using /api_endpoint/file Multipart post method and got response as fid and uri. { fid: uri: } Now when i need to add the fid to my custom field of a node which is ...
3
votes
1answer
41 views

Override base url when creating links to public files

I need storage the upload into drupal file in another server and I need change public path to files to example http://server_with_image/image How I can do this?
1
vote
1answer
30 views

How to use remote file source module

I would like to use the Remote File Source Module. But I could not find any documentation related to it. Has anyone succeeded using it? How to provide ftp hyper link inside a blog, article, forum. ...
0
votes
0answers
6 views

Migrate D6 ImageField Extended captions to D7 File Entity Inline captions

First of all, I am completely new to the Drupal world and my apologies if I fail at clearly explaining my issue, or if I am missing something that should be obvious. I "inherited" a D6 website just ...
1
vote
0answers
24 views

How is media document entity different from file document entity?

I hope this is the right place for my question as I want to understand media document a bit more. I'm working on a library website. Each book can have one or more files. Each book file should accept ...
0
votes
1answer
26 views

Files migration failed

I am trying to migrate Drupal 7 site to Drupal 8. Other migration processes work well, but only file migration fails. I have files in sites/default/files/. This is my migrate_plus.migration....
0
votes
1answer
35 views

Programmatically populate file field using Entity API

I need to programmatically generate nodes using some data that I extract from different import files. For the node creation I use Entity API. I've written a simple function to which I pass the node ...
0
votes
1answer
17 views

Attaching fields to files

I have a couple of forms where I need to attach metadata fields to files (a description, and a category). The file_entity module alone lets me specify fields, but doesn't change the form fields. ...
1
vote
1answer
110 views

How to upload file from a custom module?

I am trying to create one basic module for Drupal 8, where I have added one form with some textfields and multiple file upload element. Now on "submitForm" I am saving textfields values on database, ...
0
votes
2answers
55 views

How should I link (public) files to nodes?

I have many resources (mainly PDFs) that need to be imported to my site. Previously the files would manually be placed in sites/default/files/mydir and linked to the node like this: <a href="/...
0
votes
1answer
30 views

No more error messages shown, once i uploaded a file of invalid size?

The scenario is as follow: when i uploaded a file with invalid extension a proper error shown, everything is fine. nothing bad with invalid extensions. where as: when i uploaded a file of larger size (...
-1
votes
1answer
61 views

Consume nodes from REST export views

I am trying to import nodes from a different domain's REST export view. I am able to get all serialized nodes from the view through Guzzle but once I try to create a node from the hal+json response I ...
1
vote
1answer
37 views

How to eliminate direct access to files in private directory?

I have set up my Drupal 7 site for private files in a directory above root (../private). I also set my filefield on my node type to upload the image files to that private directory. I have two user ...
0
votes
1answer
23 views

Cannot get value of form field of type 'file' in drupal form

I have a form field such as , $form['fileTransfer_settings']['file_path'] = array( '#type' => 'file', '#title' => t('Choose file'), '#size' => 22, '#description' =>...
1
vote
2answers
16 views

Downloads restrictions through direct URL

I am developing one feature in which user will get one pdf from my site, for this I have developed a process below, 1) user will click on the link and form open in popup 2) after submitting the form ...
0
votes
0answers
15 views

What could be causing a file filed attachment not to upload?

I have a content type which has a file field for PDF attachments. Sometimes a file will refuse to upload and the throbber just spins and spins. The only way out is to reload the page or navigate away....
1
vote
1answer
40 views

background-image and sites.php

I have a multisite configuration with Drupal7, my prod site is mysite.example.mydomain.com and dev is mysitedev.example.mydomain.com I have set in sites/sites.php : $sites = array('mysite.example....
1
vote
1answer
56 views

What are folders within sites/default/files for?

There is a quite similar question in What are all the directories for in the new Drupal 8 structure? about the Drupal directory structure, but it is not explained the content of the sites/default/...
0
votes
1answer
19 views

File directory token - image field - node author

How to setup file directory where the images are saved to use tokens based on node author ? I have all setup with current user, but this is not good if moderator or admin needs to make a change with ...
0
votes
0answers
27 views

Detecting if a file path is potentially under core/

I'm implementing a patch that needs to enforce different behavior for a module implemented in Core than for a module implemented in Contrib. The test for this needs to be: Secure -- it should use a ...
1
vote
1answer
47 views

Iterate over items in FieldItemList?

In other words: How do I get the URI for each of the files in a file field that's on a custom content entity called 'listing'. Right now I have: $images = $variables['elements']['photos']['#items'];...
1
vote
0answers
22 views

Multi Site Install Problem

I downloaded drupal 8 and performed an install without any noticable incident, after completing the install I attempted to use drush to install 4 additional sites, I added the sites to the sites .php ...
0
votes
1answer
92 views

How to create an 'Upload a file' field?

I have a content entity type, and I would like to have an 'Upload file' field. I have declared the field in my Entity class $fields['file'] = BaseFieldDefinition::create('file') ->setLabel(t('...