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
403 views

Move file uploads in webform into subdirectory using hook_webform_submission_presave

I'm using the webform_multiple_file module to let users upload files in a webform. There is a second form component in that form. It's a number. I want to change the upload directory, which is defined ...
1
vote
1answer
367 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-...
0
votes
2answers
534 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 ...
2
votes
1answer
30 views

How to get the media that owns a file?

I have a file and I know there is a media that references it. How can I get this media? In the opposite direction, knowing the media id, I can get the file: $media = Media::load($mid); $fid = $media-...
1
vote
0answers
54 views

Entity browser or Media Library for PDF uploads?

Client has a custom Content Type for for downloadable PDF document detail pages, which contains an entity reference to the File media type. They want Full and Teaser view modes to display a thumbnail ...
0
votes
1answer
347 views

How to disable a file upload button for anonymous users?

I've created a commerce add to cart form with a file upload field. The user can use this to upload a logo but I don't want anonymous users to be able to do this. I can see that the file module uses ...
0
votes
0answers
18 views

How to get a second private files directory?

is it possible to create a second private files directory in addition to the existing private files directory? For a better file structure diversity I would like to set a different second location. ...
0
votes
1answer
2k views

413: File entity too large ugly error

When uploading an image that exceeds the server PHP upload image, I get the following error: My question is: Why is this error displayed so ugly and is there a way to display it more nicely, for ...
0
votes
2answers
150 views

How do I programmatically attach a file to a file field in a node? [closed]

I have a custom content type with a file field. I am trying to attach a file uploaded through a custom form to the custom content type. I am able to load the node and update all the other values of ...
1
vote
1answer
387 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
469 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
1answer
440 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
2answers
2k views

The directory tmp does not exist and could not be created

I keep getting this error since updating to Drupal 7.5.8 and cannot get rid of it regardless of trying all I know. Even adding it / copying-pasting the previous tmp dir or changing the tmp file name (...
0
votes
1answer
430 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 ...
1
vote
2answers
62 views

How do I remove the appended string from image and Javascript URLs?

I have a Drupal 8 website. I have installed the Advagg module. The URL for the JavaScript file has a string appended. https://example.com/libraries/superfish/superfish.js?pzw4cp https://example.com/...
1
vote
2answers
34 views

Why are JavaScript files read from an external URL?

Drupal adds the following markup to pages. <html class="js" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:sioct="http://rdfs.org/sioc/types#"...
0
votes
1answer
439 views

A More Efficient Embedding Method for YouTube Videos

I have created a video gallery comprised of embedded YouTube videos using the Media: YouTube Module. Everything works as expected, but the page load is slow. This is a common issue when embedding many ...
1
vote
0answers
38 views

Remote File Upload with URL Parameters

I'm currently using a digital asset management tool that allows us to host images as a CDN. The DAM allows us to crop and position the image using URL parameters (example: https://embed.widencdn.net/...
0
votes
1answer
30 views

How to add a local image file to an image field programatically

I have serveral image files in the folder /sites/subsite.example.com/files/blog.dir/1/gallery1, and I need to add these files to a node programatically. I think this is the right code: use Drupal\...
0
votes
1answer
760 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
2answers
457 views

How do I use print to generate a PDF of all entities referencing a specific node?

I'm trying to use the Print module to generate pdf's and epubs of the stories on my site. However, I need to get Print to generate these files from the story page and then generate the pdf with ALL ...
1
vote
1answer
14 views

Using different .inc files with same function names in .module file

In our project, we have this module meant strictly for our custom API endpoints for our mobile applications to use. Currently, this is handled in a single .module file like so: my_project_mobile_api....
1
vote
2answers
421 views

TinyIMCE not working: looking for image files

TinyIMCE is not working: At Hostgator, I cannot access the images that I know are in there (at sites/default/files/field/image and at sites/default/files/pictures). In the text editor, I select the ...
0
votes
1answer
505 views

create link to download file

I'm adapting a drupal module to my need. It permit to upload a pdf to insert it into a node add form in an iframe to display the file. I've need also to insert a link to download the previous uploaded ...
3
votes
3answers
1k 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 ...
0
votes
1answer
341 views

My ajax is altering form action/URL thus makes me impossible to read the $tid from it

I am using WEBFORMS which have as the topic taxonomy terms saved as hidden fields. Unfortunate, after attaching files using Upload button this terms are lost ('No category'), as ajax is altering the ...
1
vote
1answer
596 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
422 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 ...
0
votes
2answers
127 views

file_unmanaged_copy - Any service alternatives?

The functionality of the file_unmanaged_copy is exactly what I need. The only problem is: it's a global function which uses static service calls. Since I need to unit test my class (and not to mention ...
3
votes
2answers
59 views

Unable to retrieve uploaded file in submit handler

I'm creating a custom form with a file upload field that will have its contents read, processed then sent to an external API. The problem is whenever I upload the file the field for it appears to be ...
1
vote
1answer
529 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
0answers
109 views

How to make inline-files private based on role/permission by term

I am using permissions by term (https://www.drupal.org/project/permissions_by_term/) to manage a member-only area on my site. That works out easily and as it should. However, files uploaded in ...
0
votes
1answer
462 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 ...
2
votes
1answer
474 views

How to redirect all images in the files folder to a default file?

Because we work with DTAP environments, our developers work on their own laptops. To get a good view of the live environment, we copy the PROD database and the files to our own laptop. However, this ...
1
vote
1answer
586 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 ...
2
votes
2answers
522 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 ...
0
votes
2answers
60 views

How to reuse existing images in field type “Image”

I have custom ContentType with one field of type Image. Currently, when I edit a node I can only upload new images from local to server. I want to have the option to select images already existing on ...
0
votes
1answer
12 views

Modify the error message about the maximum upload file size

I would like to modify the default error message for the maximum upload file size, but I can't find the configuration. I looked at webform general settings, individual settings, and media file ...
0
votes
0answers
59 views

Upload button not showing

I am using Drupal 8.4.2. I have created my content type and I have an image field in the form fields. The image upload field is showing on the page but, the upload button is not showing. If I ...
0
votes
0answers
50 views

Detect when a new image is uploaded to my server

I have created a custom app that will allow logged in users to upload an image which will be automatically uploaded to my web server through SFTP method. Is there a module or even programmatically ...
4
votes
3answers
2k views

How to allow for files of any extension to be uploaded?

I'm surprised this hasn't been asked before like this. I want to allow users to upload files of all file extensions, without enabling each extension by hand. How do I do it?
0
votes
1answer
33 views

How can I register an already uploaded unmanaged file as managed file?

I am stuck in a point that should be easy but I couldn't figure it out. To make a long story short; I uploaded manually some images to the public directory and now I want to register them as managed ...
0
votes
0answers
11 views

Storage API + Services 3: How to work together?

I am trying to set up a site that will be storing a large amount of images. I am using Storage API module for that and It is working fine through web. Now I need a REST Service to upload images. I am ...
0
votes
1answer
42 views

The security danger of publicly exposing an upload field

On older drupal 7 websites I once faced security patches for the webform module, because file upload fields were considered insecure. There was en exploit where people could end up uploading .html ...
1
vote
2answers
149 views

Field formatter module throws cannot declare class error

I am trying to write a custom module, which defines a field formatter plugin, but when I visit the Manage display page, I get this error: Fatal error: Cannot declare class Drupal\my_formatter\...
0
votes
1answer
20 views

Change path of uploaded files in zip

I've a form that allow the customer to download every photos that a photograph uploaded before. Here is my submit form : public function submitForm(array &$form, FormStateInterface $form_state) ...
7
votes
1answer
1k views

Upload multiple files through a single file dialog?

In a Webform, I want to let the user upload multiple files via one call of the file dialog. I found the following modules. Webform Multiple File Upload Webform Multiple File With either of them, I ...
0
votes
0answers
36 views

Phar not working in Drupal 8

If I try to use a simple Phar call in my controller: $tar = new \PharData('/path/to/myTar.tar'); I get the error: "Unexpected file extension" This is because Drupal Security checks to see if the ...
4
votes
2answers
7k views

How can I load a File entity?

I want to find out whether a physical file is managed by Drupal and if it is, then load it. I'm having trouble with the documentation which keeps displaying "File not found" at crucial moments, but ...
2
votes
1answer
51 views

How do I delete files using the Content > Files interface?

I got a ticket from our stakeholders that certain outdated PDFs are googlable, and this is causing problems with people going on old information. Navigating to admin/content/files, I am able to find ...

1 2 3 4 5 47