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.

0
votes
0answers
72 views

How to password protect private files

I would like to protect private files with password in a content. For example, I created a content with some files, this field "Protected files" uses private filesystem. I would like to protect these ...
0
votes
2answers
328 views

How to print alt or title field image in custom block programmatically?

I want to print alt or title field image file in custom module Drupal 8. I load file entity use Drupal\file\Entity\File; I checked core/modules/file/src/Entity/File.phpall public function but not get ...
0
votes
1answer
21 views

How do I integrate a custom filter inside a view

I am using entity browser to view my uploaded images. And now I want to integrate a new filter to the view. My objective is to filter the images from the URI path. Currently view has a field in Filter ...
0
votes
0answers
42 views

How to configure Flysystem Sync

I need to sync my 3 years site to send the files to S3, since we are moving for Amazon simple storage solution Its been hard to find in documentation and the module issues how to do it I located ...
0
votes
0answers
53 views

How to upload a file to drupal using D8 Controller?

I am not using drupal as front end. Instead I am using drupal as backend. I want to upload a file into drupal files folder. Normal upload.php which we use is giving me an undefined $file error. I am ...
1
vote
1answer
266 views

When adding media to content, how can I search for the media by tag or term?

In Drupal 8, I created a new Media type "PDF Files." I have imported almost 30,000 of them, each complete with Title (Name), file, and the taxonomy that categorizes them. On the content type (Let's ...
0
votes
2answers
67 views

Set value of file field using entity_metadata_wrapper non working

I have a custom entity with a file field accepting multiple values. I would like to set file values according to https://www.drupal.org/docs/7/api/entity-api/entity-metadata-wrappers#example-value-set-...
0
votes
0answers
329 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
0answers
27 views

Upload file using File type=“managed_file” disappears immediately when clicked on upload?

I want implement upload zip file using FORM API where I want to show the progress bar for uploading file so I have written code like: $step2['browse']=array( '#type'=>'managed_file', ...
1
vote
0answers
206 views

How capture video thumbnail , when video is uploaded under media video type file?

I'm using Core media module to upload video[Media Type is video,which has field video of 'file field type']. This module will refer video.png as thumnail for all video uploaded from the local system. ...
0
votes
0answers
27 views

How to delete file entries on click of Remove button in file upload?

The orphaned entries of a file which is associated to the node should be removed when a file which is attached to a node is removed from it. Like associated entries from file_managed table. How to ...
0
votes
1answer
87 views

How to change upload destination from public to private when there are uploaded files in database? [duplicate]

There are a few fields that uses public upload destination. I changed it globally right now, as far as I know it uses private upload destination from now. But how can I change previously uploaded ...
0
votes
1answer
31 views

File widget custom upload location

I am working on a custom module (based on Model project) with a file field attached to my custom entities, now I would like to save files in certain directories according to entity id eg: public://...
0
votes
1answer
185 views

Custom Ajax forms with managed_file form element

We have a form with three fields - where depending on the value of the first select field, we will show the other two form elements - one select field (the options depends on the value of the first ...
2
votes
1answer
30 views

Firefox can't download private PDFs

I have an issue with FireFox where it can't download generated private file PDFs, yet Chrome has no such issue. We populate PDF files with TCPDF and they get moved and copied into a few different ...
0
votes
1answer
44 views

REST: 403 forbidden for file entities

Ok, so this is a weird one... I have a HEADless Drupal that I'm using to serve webform submissions. The webform module stores all files as private files. The issues I'm having is if I view the ...
0
votes
0answers
19 views

Change media reference from private to public?

We have a site that has well over 500 files that were uploaded into the private file system. Management wants a change in functionality, however, that allows people to directly link to the media ...
0
votes
2answers
219 views

Moving the Sites/Default/Files Directory

We have a client with simple request to move the Public File folder up simply so that links will be shorter like example.com/files/ instead of example.com/sites/default/files/. I assumed this would ...
1
vote
0answers
14 views

How to customize the file display

I have a problem that I'm unable to solve. I created content type named test player to display files with Able Player, that is an accessible audio player for blind users. So, I installed requested ...
0
votes
1answer
62 views

Menus, drush uli link, and some images not working after moving site to localhost

I've just gotten a site I'm supposed to do some work on but I'm having trouble with migrating to a local development environment. I don't have admin access to the site itself, but I do have access to ...
0
votes
1answer
70 views

How to validate allowed file types in custom module

I want to validate a field with accepted file type as PDF, XLS, JPEG, JPG, GIF, ZIP, RAR and PNG. I'm getting file types as PDF, XLS etc. here is part of my code. if ($fi_name!='') { if ($...
0
votes
0answers
45 views

Comment file upload not working

Looks like we have two versions of jQuery loading. Hence the "(...).once is not a function" errors in the console. jquery.once is definitely loaded but only for the first version of jQuery. Nightmare....
1
vote
0answers
22 views

How to initiate “Download” of the file? [closed]

For my website I have created a view, where with the help of "Views Bulk Operations" a user can check some entities and with the help of 3d party library (PDFMerger) the pdf files, related to the ...
-2
votes
1answer
64 views

Which method creates the cache directories inside sites/default/files

I am trying to solve the question SETGID bit gets reset for newly created directories inside sites/default/files. Please Note the Update-2 there. I want to know which method creates the directories ...
1
vote
2answers
555 views

How to save files to a private directory?

I am writing a custom module in which data is written to a file and the file is stored in a private directory folder. In order to do so I have created a private directory and assigned required ...
0
votes
1answer
43 views

File Types Question

Is it possible to store .obj and .dwg files and/or Unity asset bundles in a Drupal CMS? If so, is it then possible to use API requests to upload and download these files? Cheers
1
vote
0answers
32 views

check whether a user downloaded a file from private system file? [closed]

What I wanted to do is to show a tick icon (just next to download link), after a member downloaded a private file, which implemented by Protected File Module (files are saved on private file system). ...
1
vote
0answers
45 views

How to place private folder on another server?

I am designing a file store with Drupal 7. The server provider told me that I am not allowed to put the files in the current server and I have to purchase a download server beside the current server. ...
-3
votes
1answer
39 views

How to download a file from a system folder when a link is clicked? [closed]

I have a file("abc.csv") that is stored in the local system (for example: /var/a). I need to download the file when I hit a link in a Drupal site.
0
votes
0answers
131 views

How to create a Blob field type?

Is there a way or is it possible to add a Blob field type in Drupal 8? And save the files on the database? I know that there is a module Blob but it's for a Drupal 7.
2
votes
1answer
84 views

How to add an extra field in file upload widget?

I know that it is possible to enable a description field in the core file upload widget for Drupal 7. However, I want to add an extra description field like the one already present. For this I've ...
0
votes
0answers
46 views

Is there a way of deleting a file field without deleting the related file entities?

I'm working on a site that started uploading files via specific Fields appearing in Content Types, but has since moved to uploading them via admin/content/file/add for consistency. I'd like to delete ...
1
vote
1answer
296 views

How do I fix File Upload After Upgrading to PHP 7

I know this question has been asked a thousand times in a thousand different ways, but none of those solutions have worked for me. Problem: I recently updated from php5 to php7. Whenever I attempt to ...
0
votes
1answer
170 views

How to add a title text input to an image field node form widget

If you have an image field widget in a Drupal node form you can automatically edit the image alt text in there, but is it also possible to add a title text field? When I install the File Entity ...
0
votes
1answer
83 views

How to make file description field as required?

I would like to set the file description as required. I tried it with this code: function mymodule_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if ($form_id ...
0
votes
1answer
83 views

Link to content within node, from CKEditor WYSIWYG

This seems like it should be fairly simple, but I'm having trouble getting off the ground. I have a content type "Document". This content type has a field of type File, which allows for uploading PDF'...
1
vote
1answer
77 views

Unpublished file still downloadable

I have a file attached to a node via a link. The node is published but the file is unpublished. The link on the node points to the file /sites/default/files/file.txt The file is still downloadable by ...
4
votes
1answer
2k views

Delete “permanent” file when it has 0 uses

Files that are "used in 0 places" (viewable at /admin/content/files) are not being deleted automatically by cron. They also show a status of permanent. How do I allow these files to be deleted by cron,...
0
votes
2answers
832 views

How to overwrite a file upload so that the filename is always the same?

I am trying to implement a file upload form in which files are saved. I had written the following code <?php /** * @file * Contains \Drupal\avenue_product_import\Form\avenue_product_importForm....
0
votes
0answers
17 views

Should I use a 'URL', 'Path', or other form field type when the field is used to define the location that a file should be saved

I have an administrative form that allows a user to set the save location of a file. I'd imagine that valid locations would be public://foo, private://foo, and /foo/bar/foo. What is the proper form ...
1
vote
1answer
31 views

Get link address of a file

I have a page A that has an inline entity form that is referencing to page B, it's possible programmatically or in another way to get the link address of a file that page A is referencing to?
0
votes
2answers
169 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
votes
1answer
412 views

Rest File upload octet-stream uploaded file is corrupted

I use rest to post upload file (no file_entity, but core file) following direction in https://www.drupal.org/project/drupal/issues/1927648 In the app I use FileRider to get file binary for post body. ...
3
votes
1answer
115 views

Managed File is stuck with a temporary URI, even after saving it as permanent file

I was having this problem: Files uploaded via custom configuration form are eventually lost. So, I used the solution, basically: $file->setPermanent(); $file->save(); But then, even thou $...
0
votes
1answer
62 views

How to use (reference) the uploaded file to a media(video) type?

I have read https://www.drupal.org/node/2941420 and I can upload a image file then use it in article. But I can not use it as video field after I upload a video file. My Drupal version is 8.6.0-...
1
vote
1answer
38 views

How to save file with custom form?

I try to use that script in my Drupal site https://tutorialzine.com/2013/05/mini-ajax-file-upload-form I did not use drupal form api. I used my html same with that script. I created 2 pages with ...
0
votes
1answer
28 views

How to restrict file access based on file path under private directory?

I have a list of files under sites/default/files/private/abcde/manuals/. I want to add restriction to the files based on certain logic which I can add in the code in a hook. The logic would be based ...
1
vote
1answer
460 views

Save and set an external link image programatically

I have a field that will accept an image link coming from the external source. But of course, to set that image I have to save it in Drupal first. I'm wondering how do Drupal save the image from an ...
0
votes
1answer
28 views

Links to files breaking

I just wanted to see if anyone could offer some thoughts or opinions on an issue we are having. We are running Drupal 8 multisite via Aegir. We have a production environment and an identical testing ...
0
votes
0answers
64 views

How to change from Token based file download to normal path file download

I am trying to attach the document(pdf) in CKEditor using "Add Media" option. The problem is that it is making the path to download the file like this "https://domain/file/fid/download?token=xxx" ...