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
2answers
790 views

How to specify the correct private file path in a block

I have a Drupal site at http://example.org/xyz Per the instructions here, I have set up a private file directory outside the web root. So let's say the web root is at /home/public_html/example/xyz ...
0
votes
1answer
491 views

Get file ID and path to use in View template

I am working in my Row style template (views-view-fields--MYVIEW--block-1.tpl.php). I need to get the file ID and path of an image. The image field is a multi field, so I need to get all of the images ...
0
votes
1answer
364 views

How to manage video content including chapter markers and CC

I'm building a site that has 46+ videos associated with it. I'm using Mediaelement.js. Each video has at least two language .srt files, a .vtt chapter marker file and two video sources, mp4 and WebM. ...
1
vote
0answers
43 views

How to programmatically grant access to private files?

I was working under the idea that i could use hook_file_download to grant access to private files; but it seems that this hook can only be used to restrict access to files, not to grant access. I have ...
2
votes
1answer
279 views

#ajax on a managed_file custom form field is not working

I have a custom Drupal 8 form using a managed_file field with an #ajax callback but the ajax callback is never called (example below). I assume that it's because the managed file field type is already ...
0
votes
1answer
364 views

Problem with swfobject_api or jwplayer module

I have a problem with swfobject_api or jwplayer module. When I use this code in node.tpl.php everything is fine. $config='sample'; $flashVars=array( 'file' => 'path to flv' ); print theme('...
1
vote
1answer
371 views

Strip overlay context from File field

I have a basic File field set up to allow my users to attach files to nodes. However, the File field widget in the node edit form displays files as a link to the file, and the URL contains #overlay-...
1
vote
1answer
25 views

How can I delete a file served by a custom controller after it has been downloaded?

Starting from How do I create a file download URL? I've build a custom controller that allows users to download a PDF file. my_module.routing.yml my_module.pdf_link: path: '/my-module/pdf/download' ...
0
votes
1answer
496 views

Migrating files from local source are not found

I am migrating from Drupal 7 to Drupal 8 (8.6.9). Both the Drupal 7 and the Drupal 8 site currently run on my local machine. The migration of the public files goes well using: source: plugin: ...
0
votes
1answer
382 views

No working link to network files

For an intranet solution I would like to add a bunch of rather static links in Drupal to network files which change from time to time and are maintained by people not using Drupal. To achieve this I ...
0
votes
1answer
22 views

How do you set the file extension while uploading images through file_save_data?

I am trying to create a product with a product image on drupal using API. I have created a custom module for the same under which following code to upload my image to the Drupal: $path = base64_decode(...
0
votes
2answers
367 views

File validation when the file field isn't required

I have a Drupal 7 custom form where the image or file field is not required. When the form is submitted and no file/image has been uploaded, I get the following errors. Notice: Undefined index: ...
0
votes
1answer
1k views

403 forbidden error when loading images in test server

Am working with drupal7.When images are loading below error is showing in my test site console: GET sites/default/files/styles/slideshow_full/public/plans/30989/main-image/...
1
vote
1answer
392 views

File upload ajax and Radio Buttons not cooperating in registration form

I have enabled Profile 2 and profile Profile2 Registration Path modules on my site and have a really long registration form with lots of fields. I have some radio boxes and file upload fields also. ...
1
vote
1answer
556 views

How do you programmatically create a webform with a managed_file type?

I haven't been able to find a single example of how to create a webform with a managed_file type. The webform initially had the type 'file', but needs to be changed to accept multiple attachments. ...
0
votes
0answers
18 views

Image is not showing on the product edit page after creating the product using API

I am trying to create a product with a product image on drupal using API. There was nothing given regarding uploading an image in API so I created a custom module under which i used this code to ...
0
votes
1answer
688 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 ...
4
votes
1answer
276 views

How can I handle files in a cloud when when the site is configured as multi-site?

I want to run Drupal from a cloud and I am trying to figure out the design of the file system for multi-site setup. In the cloud, there are multiple servers hidden under the load balancer which serve ...
2
votes
0answers
29 views

How are compiled CSS and JavaScript files handled with S3?

I have my Drupal site set up to upload public files into the S3 bucket but am having some strange behavior with different environments and different s3 buckets. I have 3 s3 buckets: one for our ...
0
votes
1answer
770 views

File upload error. Could not

I have Drupal 8.4 running on Windows Server 2016, and when trying to use an upload field on a content type I get this error The file phpC128.tmp could not be saved. An unknown error has occurred. ...
1
vote
0answers
13 views

Managed file element in custom field module doesn't save target id

I have been breaking my head on this issue for a few days now. Using Drupal 9.2.x, I am building a custom field module for a client that has multiple fields. I isolated the problem by only including a ...
19
votes
3answers
14k views

How do I change the temporary directory without using any administrative pages provided by Drupal?

I've moved my live Drupal website to Windows localhost (XAMPP), but I'm getting lots of "The file could not be created" errors. If I log in to the site as an administrator, it fails to return any more ...
0
votes
1answer
378 views

Permission for private file to anonymous

I have an ad content type, with a file field that is in a private directory when saving the node. Ads and their files are only accesible for authenticated users. I wish I could allow anonymous users ...
16
votes
2answers
22k 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
566 views

Delete old files from server when content is updated

When a node is updated by replacing a new file upload, old files exist on the server maintaining versions. I want to delete old files from the server when content is updated.
0
votes
2answers
339 views

Let images work properly online and offline (MAMP)

I just started using MAMP to work offline on my drupal-projects. Because MAMP and working offline is new to me I started today with a test-website. I installed MAMP, no problems. I installed a new ...
0
votes
0answers
26 views

Is it possible to generate a link to a private file that can be shared with an anonymous user to download the file?

In Drupal 8 we need to generate a link to a private file that can be shared with an anonymous user to access. In our function we have the file object for the private file and are currently generating ...
0
votes
1answer
15 views

Front and backend public files not found [closed]

I'm trying to display some image in my front and my backend, a simple image, not a media, but I'm always receiving a 404. For example, I'm trying to display the icon from my paragraph, to i'm ...
2
votes
2answers
544 views

How can I update file attachment and keep filename?

I understand changes of file attaching in D7, but problem is, if I delete and re-upload changed file, the deleted file is still on server and re-uploaded filename gets changed. If I understand ...
1
vote
1answer
720 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 ...
1
vote
1answer
619 views

How to make blob file downloadable?

I have created a Module to make blob file available for Download in Drupal 7 . Below my code for .module file <?php function blobfile_block_info() { $blocks = array(); $blocks['...
0
votes
1answer
423 views

Organize node file attachments into groups

I have a content type with multiple file attachments to download. Is there a module to give authors the ability to divide all the attachments into groups, writing a title for every group, just like ...
1
vote
1answer
706 views

How do I attach an existing file to a node?

Here's my problem. I have a D6 site which has been in production for a number of years, and in consequence has used various methods (and modules) for displaying images within body text of book pages. ...
0
votes
1answer
672 views

Module webform2pdf modify template

I have sereval webforms et each webform send a mail with a pdf. I would like to do a template for each webform. I use webform2pdf in Drupal 7 to send pdf by email. How can i do that ?
1
vote
2answers
31 views

?_format=json does not produce JSON for files, REST

I am using Drupal 9.3 with REST UI, RESTful Web Services, and Serialization enabled. For the REST UI, I have the following configuration for files: Methods: GET, POST, DELETE, PATCH Accepted request ...
2
votes
1answer
437 views

How can I load CSS files located outside the web root 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....
3
votes
2answers
814 views

how long do files hang around in temporary://?

I want to offer a file download to my users, and I was thinking of using temporary:// to store the data. But how temporary is it? When do files disappear from it? Of course, I want to avoid having the ...
0
votes
2answers
385 views

Can I use plupload to load multiple image files into a single image field

I have an image file field on my Drupal 7 site that allows users to add 4 images. I would like to give my users the ability to load all 4 images at once. I have discovered the plupload module and ...
0
votes
2answers
1k views

RewriteRule causing internal redirect limit error

I am trying to server a static HTML site from /sites/default/files/staticsite and make it available via a subdomain. I'm hosting the site on Acquia Cloud, and their docs describe Maintaining a static ...
2
votes
1answer
558 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 ...
0
votes
1answer
591 views

How do I create a file download popup form?

I am new to drupal, and I want to create a popup form with with form fields for name and email, and a buttom to download and to close the popup. When users click on the download link, the popup form ...
2
votes
1answer
848 views

How to get an export option as a pdf for views?

I am using views on my Drupal site I can able to export my view in csv, but I am not able export my views as pdf I need to export my view as pdf. Any suggestions on this it will be very helpful, ...
4
votes
3answers
15k views

Why drupal_realpath('public://') returns an incorrect path?

I am calling drupal_realpath('public://') inside a module function. Why am I getting a path like sites/all/modules/current_module/sites/default/files from drupal_realpath('public://')?
3
votes
1answer
723 views

How can I create an alias to point to an uploaded file?

Users uploading a file within content create a name like my_site.com/sites/default/files/import/CrazyLongNamefile.pdf They would like to alias it for referencing in other media (print) like my_site....
1
vote
1answer
1k 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 ...
0
votes
2answers
1k views

How to open file in new tab instead of download when submitting form?

The code below downloads the current file, I need it to open the file in a new tab, what needs to be added in order to do so? public function submitForm(array &$form, FormStateInterface $...
1
vote
4answers
513 views

Add another item by multivalued fields directly from node (or entity) view page

I have a file field which can have unlimited number of values. I am using File Entity module. As default, if users want to add more files, they must edit the node. I'm looking for a solution to give ...
0
votes
2answers
534 views

Limit the number of uploads per image field depending of role

I need a hook (or something similar) where I can set the number of image uploads depending of the role of the user. In the settings of the field there is no way to set the maximum number of values ...
3
votes
1answer
591 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. ...
2
votes
1answer
912 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 ...

1
2 3 4 5
49