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

Replacing a pdf

I am looking to delete a file permanently. It says that is is not being used in any places and I have deleted it, but it is still showing up. I want to replace it, but Drupal just keeps making a new ...
0
votes
1answer
222 views

Force download string as text file

I'm trying to return the results of a db_query as a raw text file. The php solution uses header() to instruct browsers to download content. I've attempted using header() in an AJAX callback function, ...
0
votes
0answers
50 views

Set two file_public_base_urls and two file_public_paths in settings.php

I need to set two file_public_base_urls and two file_public_paths in settings.php in Drupal 8.7. and have them associated with each other. For example: $settings['file_public_base_url1'] = 'http://...
0
votes
0answers
27 views

How do I load a file in a managed_file field inside an edit form?

I'm building a custom module (Drupal 8) which implement new elements I called components. I have a component creation form which has a managed_file field which works well, it submits, save my image ...
0
votes
1answer
26 views

How do I reference a file field and node title from another content type & node?

I need to add a link to a file, added through a file field on its own content type called "Document" from another content type and node call "plan information". The idea is that the "document" nodes ...
0
votes
2answers
438 views

chmod() and touch() operations not permitted [closed]

After updating drupal8 for 8.7.0 and then to 8.7.1 versions i have next errors: Warning: chmod(): Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line ...
0
votes
0answers
36 views

Private file upload using core's contact module

I am using the core contact form module for user applications. I have set a private file upload directory in settings.php. When the user submits the application form I require them to also upload a CV ...
-3
votes
2answers
226 views

Upload file to S3 directly instead of using temporary storage

I have one file uploading form in Drupal 8 where I am uploading 3 different assets and they might be around 2gb or more in size. I have the s3fs module enabled and configured properly, but (due to ...
0
votes
1answer
36 views

How to add file extensions while creating a field (type file) through the module installer.yaml?

I need to add 4 fields to an existing content type in Drupal 8 website, 2 of them is text another 2 is file type, I have a multisite setup and have 30 country-specific sites so I need to add for every ...
0
votes
2answers
5k views

Unable to upload files. Though the maximum file size limit is 80 MB, can't upload even 50 kb files

I copied a site from localhost to AWS server. I can easily upload files in localhost but when I try uploading in the live site it gives me the error "An unrecoverable error occurred. The uploaded ...
1
vote
2answers
85 views

Cannot download generated files

I have a site (Linux/Drupal/Apache) that generate a .xlsx file from custom code and its saved to files, but after that I cannot download it from drupal, it give permission denied. Forbidden You don'...
0
votes
1answer
152 views

Handle file requests

I'd like to be able to intercept calls to files (.pdf for instance) in order to run some custom code before the user accesses/downloads the file, and add a cover page accordingly. From what I ...
1
vote
2answers
4k views

Apache AddDefaultCharset utf-8 - filename not saving in utf-8

Using file field to upload image which has utf-8 filename, but when it is uploaded to site filename is not saving in utf-8 format.But original name is saved as link in database making it not found ...
3
votes
0answers
687 views

How to pipe file uploads to subdomain?

I've got a Drupal 7 site on Apache and Varnish, sitting behind the CloudFlare CDN. Everythin on mysite.com goes through cloudflare... I also have a "direct access" subdomain set up at direct.mysite....
0
votes
0answers
50 views

What are the appropriate file security settings and Apache settings for Drupal sites running on a VPS?

I would be grateful for some help on this one - I have looked at the other posts on this subject with interest, but they don't seem quite to fit my situation. I'm not a great Unix expert, but there ...
0
votes
1answer
302 views

Changing default file permissions for group?

I'm not super familiar with the permissions structure in Drupal 7 so I'm not sure if this is actually an Apache question or a Drupal question. I have a style.css file in /sites/all/themes/mytheme/...
0
votes
1answer
85 views

Is it possible to serve a theme from outside the web root?

We have a need to keep a proprietary theme in a directory that isn't readable or writable by a client. At the same time, the client needs to be able to do standard Drupal updates (ie, they will have ...
0
votes
2answers
710 views

CSS Mime Type transferred as Zip in Chrome - 15 second delay

Resource interpreted as Stylesheet but transferred with MIME type application/x-gzip: "http://www.energyjustice.net/modules/system/system.base.css?m7sb47". I turned off the CSS aggregate and ...
3
votes
0answers
1k views

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

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

Lots of permissions errors, should the entire site be set to www-data?

This is my first time configuring a lamp stack and I'm running into lots of problems with permissions. Here's an example of one of the errors The specified file temporary://fileChLMzd could not be ...
5
votes
1answer
1k views

Bulk saving nodes with a file field

I'm in the progress of creating a bulk upload function for a Drupal site. Using flash I'm able to upload the files to a specific url that should be able to handle the files. What I want to do, is not ...
2
votes
3answers
5k views

Upload Images to specific folders

how do I upload images (Media) to specific folders inside the default directory? I will have thousands of pictures and would like to have an organized structure of folders. Thanks a lot.
0
votes
2answers
65 views

Filebrowser thumbnails “can not create img for private://”

I am using Drupal 8.7.5 and PHP 7.3.7 running on Apache 2.4.6. UPDATE: I'm trying to make available a library of images to the public. I chose the content type of 'Directory listing' to do this. In ...
0
votes
1answer
38 views

Additional file entity fields in widget_form

I've added additional fields to my file entity types and would like to have them in upload widget, just like file description. How can I add my custom fields element using field_widget_form_alter? (...
1
vote
1answer
364 views

How to set the public file path to migrate site files and images through Migrate Drupal UI

I am working on migrating a drupal 7 site to drupal 8 site that has image fields in content types, as well as some pdf files that I am trying to migrate through the Migrate UI. None of those files are ...
11
votes
2answers
10k views

How to get the url of a file field of a given node?

$node->field_file gives me a FileFieldItemList while the first entry seems to be a FileItem. $node->field_file->getValue() gives me an integer (I guess the file id). How can I actually get ...
0
votes
0answers
11 views

Webform includes attachments only on manual resend, but not on initial form submission?

Using Webform and Mimemail to send HTML emails and uploaded files attached to emails. When submitting the form, the file is not attached to the email. The box is ticked: But if you edit the ...
0
votes
0answers
42 views

How can I migrate an Amazon S3 bucket to into Drupal?

SCENARIO I currently have a bucket where all my images are hosted and stored. I currently display them by simply using URLs that link to the images (i.e https://[bucketName].s3.amazonaws.com/[...
-1
votes
1answer
546 views

message: “No PDF generation tool found! Please dowload a supported PHP PDF generation tool … ”

I installed print module but I got this message when I wanted to install PDF section, I was reviewing pdf modules such as dompdf mPDF TCPDF wkhtmltopdf but any works when I want to install them, ...
2
votes
1answer
40 views

File upload via REST returns 403

I've been attempting to get a file to upload using REST services and have been having a heck of a time getting it to work. All attempts come back as 403 (Forbidden). Here's the code: export const ...
1
vote
1answer
316 views

How do I alter images being added via IMCE CKEditor plugin?

I just wanted to share my solution since I did not find any clue or different way of fixing the following problem: Formerly, you could add a default class/ alter attributes of newly inserted images (...
0
votes
2answers
5k views

How do I generate PDF of HTML in a custom module?

I want to generate PDF in my custom module. Using print module we can print node. But I have made html in my custom module and that I wanted to make pdf and save it in files. I have tried custom ...
1
vote
1answer
426 views

File creation date

I have a function in template.php: function test_file_icon($variables) { $file = $variables['file']; $icon_directory = drupal_get_path('theme', 'test') . '/images/icons'; $mime = check_plain($...
-1
votes
2answers
197 views

File upload form element that will allow the user to select files from server [closed]

I want to achieve (Create a form that will allow the user to select files from server) in Drupal 8.3 and have followed steps 1 to 4 but for some reason it's not working at my end. Can someone shed ...
0
votes
0answers
85 views

Files migration issue

I am following this tutorial on how to migrate files from D7 into D8. I have the migration setup with the following yml configuration: uuid: a685a4e0-1022-4bf2-a787-f6f1bef587ea langcode: en status: ...
1
vote
1answer
148 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 ...
2
votes
2answers
976 views

How can I stop auto uploading of managed_file elements?

I am trying to create a field to upload the xml format of site map. But when I add a file to my filed it automatically uploaded and saved in the S3 bucket before I click on the submit button. The ...
0
votes
1answer
1k views

How can I get public files path in javascript files?

I want to display files present in the public folder(sites/default/files). So in the module file when I click on a link it will call to js function, How can I get all file names which are present in ...
0
votes
2answers
10k views

Get an error message “invalid file extension”

I always get the error message: "Invalid file extension" when I'm trying to upload a PDF file? Does anyone know how to solve that problem?
0
votes
1answer
195 views

What is the Drupal 7 version of FILE_STATUS_TEMPORARY?

My use case is that I want to set an uploaded file as FILE_STATUS_PERMANENT until I know it has been processed correctly by my custom module. Once that is done, I'm happy for Drupal to delete it. ...
0
votes
1answer
190 views

Cron job to transfer files to remote server

How would I go about scheduling a monthly file transfer (via FTP) to send files in a specific directory on my remote VPS to a server on my internal Corporate network? Once files are transferred, I'd ...
0
votes
0answers
346 views

mp3 not loading in opera and chrome when in private folder

I have audio on my site which is rendered through media module. The audio files are in private folder at sites/files/private In firefox, all is fine. But in opera 31 and chrome 45 the files do not ...
1
vote
2answers
705 views

Is there a html5 video player for Drupal 6 that run well on ios device?

I need to play videos on my drupal 6 site that would run well on IOS device (HTML5?). Is such solution available? My site currently serving flv files using jwplayer 6.x-1.1.
0
votes
1answer
703 views

How can I save a file in specific folder?

I want to upload files to specific folders. How can I achieve this programatically. How can I modify below code such that upload_location should be dynamic. $form['document'] = array( '#type' ...
1
vote
0answers
39 views

Extract compressed files

How to extract zip files after the upload successfully, I'm using File Field Paths to upload files.
1
vote
1answer
2k views

Remove uploaded files before the 6 hours cron?

I have a custom Content Entity in wich definition there is a 'file' field. The file widget works fine. The 'Browse' button allows to select a file and uploads it to the proper server directory and the ...
145
votes
11answers
188k views

What are the recommended directory permissions?

I'm gearing up to deploy a Drupal 7 site and I can't find any documentation about what the recommended security-conscious file and directory permissions should be set to. Specifically default/files/ (...
0
votes
2answers
596 views

How to save file to different server?

I want to specify a different file system remote server path. So that if I upload a file then this should be served from different remote server. I am using Drupal version 8.
-1
votes
2answers
198 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 ...
8
votes
1answer
2k views

Prevent file renaming

I have a user who is uploading a number of files with the same file name. It is important to them that the files are never renamed. However, the files are getting _1, _2, etc on the end. Is there a ...

1 2 3 4 5 47