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
0
votes
1answer
758 views

Remove an uploaded file

I am working with files in a Drupal module. I added this form: $form['Background_image'] = [ '#type' => 'managed_file', '#title' => t('Image'), '#...
-2
votes
1answer
51 views

Not able to access uploaded images in AWS

When we upload an image using the URL 'https://website.com/file/add' , the image is getting uploaded. While uploading, we have chosen the destination as ' Public local files served by the webserver' ...
0
votes
0answers
12 views

Setting default upload paths for media

I really want to have an organised files folder in my d8 project. I have two main media fields: field_banner AND field_image They appear in all my content types. I would like that all the the media ...
1
vote
1answer
2k views

Max File Upload Size set to big, but Ajax Error with old file size

I have changed the upload_max_filesize and the max body size in my php.ini to 15 MB. It used to be 2 MB. Drupal displays the max file size correctly, but when I try to upload files bigger than 2 MB - ...
1
vote
3answers
767 views

How to implement access permissions per individual field and individual nodes?

I know there is https://www.drupal.org/project/field_permissions module, which allows to set field permissions per role, however what I need is to provide each individual field access permissions. As ...
0
votes
1answer
1k views

Large file uploads stop immediately, 404 error

I am having a weird problem with uploading large files in the Drupal admin's file field. I have the size limit set to 500 MB. I also have the php.ini settings for upload size, post size, and memory ...
2
votes
1answer
834 views

How do I integrate media (e.g. attaching audio) to nodes?

I installed the Media Entity module for Drupal 8. I thought it would somehow facilitate adding Mp3, etc, as Media does in Drupal 7, where I could specify a media player type for an audio file. (And ...
4
votes
2answers
1k views

How to select files from /sites/default/files with IMCE filebrowser?

Somehow the settings of directories in the configuration of IMCE (7.x-1.7) is pointing to <root>/. which lets met start in the private_files directory but not in the (public) files directory. I ...
1
vote
2answers
1k views

“File (Field) Paths” and “Media” modules: files not saved in the intended folder

I'm trying to use both the "Media" module (1.4) (to manage uploaded files) and the "File (Field) Paths" (to keep the uploaded files organized in various subfolders). Basically, I have a content type ...
1
vote
1answer
2k views

“b.handleError is not a function” on image remove/upload

I was not able to upload/remove CCK field images from the UI; when I looked at the console in Firebug, it said, "b.handleError is not a function." When I look for this error on Internet, I keep ...
0
votes
2answers
1k views

Where is FID xxx used?

Is there a way to see where a file is used, with FID? I see the entry in the file_managed-table (Drupal 7), but not where it is used.
0
votes
1answer
348 views

Vimeo password protected run in Drupal

I am working on drupal 7 I am video embed field for viemo setting and saved the field display setting to vimeo player I saved password protected video link from vimeo. For the first time I play the ...
2
votes
1answer
839 views

Clear managed_file field on submit

I'd like to clear the managed file field each time the contents are sent off for further processing on submit. The callbacks work fine, but I have repeatedly come unstuck in my goal of having a "...
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 ...
1
vote
1answer
159 views

Site seems to miss the “private” wrapper, how can I fix it?

I can not enable the private folder getting the warning as below: Warning: file_exists(): Unable to find the wrapper "private" - did you forget to enable it when you configured PHP? in ...
1
vote
1answer
1k views

Retrieve File Url from Upload Form When Form is submitted

I have the following code in my form. function video_subtitles_menu() { //print "video_subtitles_menu 1";exit; $items = array(); $items['video_subtitles_test/upload'] = array( //this creates ...
4
votes
2answers
1k views

Upload file and fill in fields in one step; or trigger a rule when a file is uploaded

I want to make use of the Media module and the File entity module to upload files, in particular images, to my site without having to attach them to a node. Solely uploading images works like a charm, ...
2
votes
1answer
822 views

Unable to set file upload destination private when programmatically creating new content type with file field

I am creating a module to upload video to an in house media converter - as part of the module installation I create a new content type called "user video" which has a file field as part of it. I need ...
0
votes
1answer
2k views

Programmatically upload a file to a custom file field

I am trying to update a node and programmatically upload a file. $nid = 45343; $node = node_load($nid); $image_url = 'http://test.com/misc/druplicon.png'; $file = system_retrieve_file($image_url, ...
1
vote
1answer
980 views

How to add delete button to file field upload widget that actually deletes the file (not just association with content)?

After uploading a file with the File widget for the File field, the file is on the server and remove only disassociates the file from the field (and the content that the field belongs to). I would ...
2
votes
1answer
2k views

Display Auto Generated Youtube Thumbnails with 'Video Embed Field' Module in Views

I added some videos to my site and I'm using views to display them. I followed a tutorial and i used the rewrite the output option of the view with allowed replacement patterns to display videos in ...
1
vote
1answer
810 views

File field upload in modal/dialog

I have a custom content type with file field as one of the fields. For theming/UI purposes I should make this file field as clickable button. And only when user clicks on it, he/she gets modal window ...
0
votes
0answers
12 views

Using image styles with a normal “managed file”?

I created a content type with 4 fields on it: Private Image Field Public Image Field Private File Field Public File Field I am able to access 1 and 2, as they are image fields. But if I upload an ...
2
votes
1answer
777 views

How to show list & thumbnail widget in plupload?

I have installed the following modules: FileField Sources Plupload, FileField Sources, Plupload module and added latest plupload library. While uploading multiple files it is showing only list of ...
0
votes
2answers
701 views

The file names are not transliterated on upload

I am using Drupal 7 and have transliteration module enabled. I have a file field and I want to have the names of the uploaded files to be transliterated on upload. The url alias for the nodes are ...
0
votes
1answer
877 views

The “Remove” button is not working

I'm using a "managed file" to upload an image, which works fine, but if you want to remove the image by clicking on the "Remove" button, nothing happens. $form['logo'] = array( '#type' => '...
0
votes
1answer
358 views

Get file extensions in drupal exposed filter

I had a content type with a file upload field. The user is restricted to upload files with specified extension in Allowed file extensions settings. I created a view for listing all files. Now i need ...
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 ...
0
votes
2answers
716 views

Migrating to XAMPP local install - Configure the temporary directory

I have copied a site I have on a VPS down to run from XAMPP on my local machine. When I restore the site using Backup and Migrate I get the error message on all pages of the site: The specified ...
0
votes
0answers
352 views

How to upload a base64 encoded image using API

I am trying to submit enquiry form using api. I am able to post data through api by using the endpoint Endpoint: url/contact_message?_format=json Body: { "contact_form":[{"target_id":"...
0
votes
2answers
9k views

Add header and footer for every pages printed

I've used print module version 7.x-2.0. I've used pdf-version and print-friendly-version. Now i want to do two different things. That is, Is it possible to add separate CSS for pdf, html or email ...
0
votes
0answers
35 views

How can I replace static file and media links in content with their equivalent entity references?

I imported content from another system. So, for example, the body has typical html, like this: <img src="/images/image.jpg /> All of the media assets that are referenced as static html, those ...
0
votes
0answers
17 views

How can I get an image form to maintain image order after deleting one?

I have a content type with a field for images. The field accepts multiple images and after I upload several, I re-arrange them to a desired order. After re-arranging them, I can enable "Show Row ...
0
votes
1answer
29 views

How to download from private// following a link?

I have a custom entity (contract) created in a custom module (amap) by a bunch of BaseFieldDefinition, one of which being $fields['file1'] = BaseFieldDefinition::create('file') ->setLabel(t('...
0
votes
0answers
8 views

managed_files with named that already exist are being renamed, but original file name returned

I am trying to add image upload functionality to my custom module. Images are successfully being uploaded via the following: ` $form['slide']['dbs_img'] = array( '#type' => '...
0
votes
1answer
349 views

How to make uploaded file permanent to node without node submit

My module automatically save new empty node when user create new node and redirect to edit this node. Now, is it possible to make uploaded file on _node_edit form without submitting form? edit: When ...
0
votes
0answers
37 views

Grant file access to file downloads

I am able to sell a file using Ubercart Drupal 8 module. However, file download permissions are not granted to the user purchasing the file. Do we have a Rule in place for this? How can I achieve ...
0
votes
3answers
791 views

How to set and use direct files folder path in a multisite installation

Drupal 8 multisite install where First site is on a subdomain one.example.com Second site is in a subfolder one.example.com/two How can files folder for both sites to be accessible via URL/files ...
0
votes
1answer
376 views

control over what prints on first and second page of pdf

I am generating pdf using dompdf and my website is running on Drupal 6. I have a requirement wherein I need to print part of my html on first page and some part on second page in some cases. Also ...
0
votes
1answer
347 views

Picking image from server: FileField_Sources not working

I currently have some nodes that use images. Problem is: every time I want to choose an image, I have to upload it again. It would be much better if I could just use a path picker, which could show ...
0
votes
1answer
181 views

How to alter response headers from module hook

I am puzzled how to alter the response headers from specific hook (hook_file_download)? /** * Implements hook_file_download(). */ function example_file_download($uri) { $scheme = FileSystem::...
12
votes
4answers
15k views

Storing data / session for anonymous user

I am working on a shop, and for the cart, i need to store items before payment. $tempstore = \Drupal::service('user.private_tempstore')->get('boutique'); $tempstore->set('poids', $...
-2
votes
1answer
41 views

Strategy for Import/exporting Drupal8 as content and structure

We are setting up feature>dev>production environments on Platform.sh for a Drupal 8 project. Expecting multiple contributors to the project, we have run into a slight snag regarding Importing/...
0
votes
2answers
209 views

Image Styles Not Generating Thumbnails/Previews

I have File Browser installed on my website. The module info can be found here: https://www.drupal.org/project/file_browser When I go to browse for pictures, there are no images. You can see what I ...
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 ...
1
vote
1answer
362 views

Uploaded file not shown in custom content type / Image not attached to content type

In Drupal 7, I am trying to upload an image that belongs to a custom type. I click the Browse button, choose the file and upload. Until there, all seems to work well. However, when I click next, ...
3
votes
2answers
913 views

Adding accept attribute to managed_file field to specify file types client-side

I've got a file field in a custom form like this: $form['image_upload'] = array( '#type' => 'managed_file', '#title' => t('Image upload'), '#description' => t('Upload png ...
1
vote
2answers
362 views

Mapping existing file against a new content type

I am facing a situation here. I have a content type A with an image field(field_upload_snaps) in it. There is another content type B which also contains an image field(field_valid_snaps). Now user ...
3
votes
2answers
3k views

Create a zip file from a list of selected files and make the zipped file downloadable

I have a list of image files. I need to archive those files in zip format and make the archived file downloadable. I have seen ArchiverZip class defined in the system module of Drupal 7. But I couldn'...
5
votes
2answers
2k views

Displaying the contents of a document file (doc, docx, etc.)

I'm looking for a way to display the contents of an uploaded document file such as a .docx file. In Drupal 6 I used the iPaper module which did the trick as all I needed was api code to connect ...