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
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
0answers
46 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
60 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 ...
4
votes
1answer
597 views

How to avoid appending incremental number to filename

I don't want Drupal to add incremental numbers to my file names to make them unique. I want to always have files stored with the same name they had when I uploaded them. If the file with given name ...
0
votes
2answers
90 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
31 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', ...
2
votes
0answers
239 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
52 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 ...
3
votes
2answers
2k views

Managing multiple versions of files on nodes

The client needs to be able to upload numerous files to each node. They would like only the new versions of files to be searchable/in the search results and for the previous document versions to be ...
10
votes
2answers
10k views

Get the real path of a file

I am creating an Excel reading module in Drupal 8. I want to get the real path of a file for reading it from a path like public://2016-03/Places.xls. What function should I call for getting the real ...
0
votes
1answer
102 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
2answers
72 views

Migrate Private Files: FILE_EXISTS_REUSE still duplicate files

I'm trying to migrate private files (file migration), the problem is even I set file_replace to 'FILE_EXISTS_REUSE' the files are still duplicated (it adds _1 or _2, and so on.). Here is my mapping: ...
2
votes
2answers
1k views

How to attach/upload a file to node using restws?

I've got a content type with "File" field and "File" widget. I am successfully able to create a node without a file using restws. But, if I want to attach a file to it, it just doesn't allow me to do ...
0
votes
1answer
221 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 ...
0
votes
1answer
37 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
2answers
286 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
2answers
747 views

How do I setup Drupal with EC2 scaling?

I want to scale my Drupal site and I was wondering how to approach it with Drupal and Amazon EC2. This is a bit related to How to use Drupal in the cloud with on demand instances. With Amazon, I can ...
2
votes
1answer
35 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 ...
6
votes
3answers
6k views

How to upload a file in Drupal 8?

I'm a brand new Drupal user and I just installed and started configuring a Drupal 8 instance. I've had no problem tweaking the theme, and creating text content, but I can't seem to find the button to ...
0
votes
0answers
20 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 ...
1
vote
1answer
4k views

How do I upload a PDF for users to download?

I am very new to Drupal. I simply want to provide a link in an article for users to download a pdf document. How do I upload the document on the admin side and then link to it in an article?
6
votes
2answers
3k views

Mixed public/private file upload

In Drupal 6, the Private Upload module allows you to specify that a node file attachment should be stored in the private file system, so that it is not directly accessible by URL. There is a checkbox ...
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 ...
2
votes
0answers
521 views

Rule to send an e-mail with the URL of an uploaded attachment after node change

I have a Drupal 7 site with a custom node type with a custom attachment field. After a (kind of this custom) node has been published, I got an e-mail with the help of Rules module. I would like to set ...
1
vote
2answers
789 views

htaccess in files folder breaks displaying of images

I installed media module and all files in /file directory became unreachable - browser gives 500 internal server error. I can confirm files exist there. After removing htaccess from files directory, ...
3
votes
0answers
1k views

How to set up permissions while using dso as PHP handler?

I'm having all kinds of troubles while setting up my site online. I can't upload new modules and if I try caching this is what I get: Warning: file_put_contents(temporary://filedwZLkV) [function....
0
votes
1answer
84 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 ($...
2
votes
2answers
842 views

How to set the file status of files uploaded through theme settings to permanent?

I have been trying for a week to get image files uploaded to a Drupal server through the use of "managed_file" theme settings to remain on the site longer than the default 6 hours. I have visited the ...
2
votes
1answer
878 views

What is the proper way to set up an AWS Auto-Scale group? [closed]

What is the proper way to setup an EC2 Web Server with the aim of serving a site which experiences high demand once a month via 1 small EC2 for 90% of the time and then enter a load balanced group for ...
0
votes
0answers
46 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
66 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 ...
4
votes
8answers
10k views

Best way to display PDF in drupal as a slideshow

I'm looking to display a PDF on a page, but don't want to outsource the hosting to scribd or slideshare, or one of the other players. My constraints are basically... I want to host it on my site. I ...
1
vote
2answers
710 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
414 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
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). ...
-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.
1
vote
0answers
47 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
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
0answers
149 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.
1
vote
1answer
2k views

How do I attach files to nodes?

I need to add files to multiple value file field using drupal rest api (restws module). return format of restws is something like this : "field_files": [ { "file": { "uri": "...
1
vote
3answers
5k views

Webform File Upload field

I'm using Drupal 8 with Webform module. I want to allow users to upload one or several files when filling the form. Is it possible with Drupal 8? May be some additional module required for this?
0
votes
0answers
65 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" ...
0
votes
0answers
49 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 ...
20
votes
5answers
34k views

Get Image URL in Twig

I want to render an image as a background image via an inline style in twig. I created a field called bg_image and attached it to the standard plain page. After fiddling around for hours I was able ...
1
vote
1answer
331 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 ...
4
votes
3answers
6k views

How can I get the file id if I use the file_save_data function?

I will be adding new media files in D8 programmatically, how do I determine what the fid should be for each one? also how do i put the actual file contents into the media type? this is my code $...
0
votes
1answer
191 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 ...