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
0answers
17 views

Can't upload anonymously using webform

I am using varbase 9.0.0-rc1 distribution I have successfully uploaded files using the forms while I am logged in. But anonymously I get the following error: An error occurred while attempting to ...
-4
votes
0answers
19 views

The usage of the public:// in drupal 8 [closed]

Why it will report an error? use Drupal\Core\Database\Database; use PhpOffice\PhpSpreadsheet\IOFactory; $reader = IOFactory::createReader('Xlsx'); // Load $inputFileName to a Spreadsheet Object. $...
0
votes
1answer
36 views

Why does the upload progress bar reset at 40% when uploading large files?

I'm uploading a 5 GB file and the upload progress bar resets at 40%. When it gets to 40% it starts counting again from 0%. Eventually the file does upload completely but this is not good UX. I was ...
0
votes
0answers
24 views

Fatal error: Uncaught Error: Call to undefined function file_save_data() [closed]

I have few PDF files that I want to save in Drupal with file_save_data function but when I run drush cr I get this error: Fatal error: Uncaught Error: Call to undefined function file_save_data() Here ...
0
votes
0answers
25 views

How to migrate PDF files to specific node

I have a directory with PDF files and I have 45 nodes of content type Download. I have to migrate each PDF file to specific node. All PDF file names I read from a CSV. Before these PDF files, I had to ...
0
votes
1answer
44 views

Cannot upload file of type image

I am experiencing a really strange behavior I have never seen before with Drupal. I am able to upload files of every type but not images. The files system is public. The problem appears on the local ...
0
votes
0answers
25 views

How to upload multiple files in a custom form with Form API [duplicate]

I have a custom form created with Form API. In this form, I have a file field with the type managed_file $form['fichiers_justificatif'] = array( '#type' => 'managed_file', '#title' => '...
0
votes
0answers
29 views

How can I import a file content?

Using feeds, given a URL, I would like to get the content of a file into a node text field. In the case of an image, I can map the image URL to a image field and see the images on the page. If I do ...
-3
votes
0answers
27 views

tmp directory is not properly configured

A single Drupal instance is failing to write to the tmp directory and I cannot figure out why... All my other instances are fine. tmp - root:root - 1777 Any tips or tricks I can try? The specified ...
0
votes
0answers
26 views

S3FS S3 module image source issue

I'm using the S3FS module to use an AWS S3 bucket as my sites/default/files directory. When I upload images they are successfully uploading to the bucket. I edit a node and include the same images via ...
1
vote
1answer
13 views

testing scheduled file deletions

Long story short, is there a correct way to override DRUPAL_MAXIMUM_TEMP_FILE_AGE? I'm working on testing a fix to a module I wrote a while back that handles some uploaded files. I neglected to call ...
0
votes
1answer
16 views

Image Files Uploaded via REST got Temporary status - Cannot be refereced by Media Image

Drupal 8.9.11 Image File Uploaded via REST gets "status - Temporary" while setting explicitly "status" case to True server error 403 (code in python) "status": [ ...
0
votes
0answers
27 views

FlySystem problem, file can not be uploaded into directly that exists

I had created a question in order to config FlySystem module correctly for Drupal 8 to work with ftp. you can see it here. fortunately with @mbomb007 helps, I could do it. but another problem happened ...
1
vote
1answer
23 views

Image File Upload via REST case Error 500 response due destination directory not set

I'm struggling to upload images to the Drupal 8 site via REST. Finally, I managed to deliver the file to the server, but then the error 500 rased due destination folder not set. I can't figure where ...
0
votes
0answers
14 views

Is it possible to run code when the REMOVE button is clicked from a managed file?

I have a managed_file field on a custom form when I need to run some code if the REMOVE button is clicked after uploading a file. PURPOSE: When a user uploads a file to the managed_file field on the ...
0
votes
1answer
32 views

How can I rebuild an image field with values in an Ajax callback?

in Drupal 8 I have media form with select box having ajax property and an image field. on select box value change I want to assign specific file to the image field. On form_alter this code work, the ...
0
votes
1answer
36 views

Apache SOLR index or retrieve the node a file is attached to

I'm building a search engine with Apache SOLR (8.7.0) where PDF files are indexed and searched through, that part is working (with search_api_attachments in case you're wondering). However, the client ...
-1
votes
2answers
57 views

How to convert a file into File Entity

I need to use file_copy in a custom module in D8. The function file_copy requires the first parameter to be a File Entity. Here is what I have tried but it doesn't work and returns an error: TypeError:...
0
votes
1answer
31 views

Is it possible to host private files on remote file server in Drupal 8?

I want to know, In drupal 8, is there any way to host all private files on remote file server separated from host server. Files must be uploaded or removed from remote server directly from Drupal site....
3
votes
0answers
74 views

Image derivatives removed by some process, only regenerated when switching to maintenance mode, then removed again

While moving a bunch of legacy D7 sites to a new server, I bumped on the following problem with one site only. This is certainly NOT the classical permissions issue on files directory. Bug description ...
1
vote
2answers
45 views

Programmatically uploading and validating a user_picture

I use the following code to modify the image in the user_picture field of user with uid 42: // Get user. $user = \Drupal\user\Entity\User::load(42); // Create file. $file = file_save_data( ...
1
vote
0answers
31 views

Updating a Node image field from an external URL

I need to retrieve an image from an external URL and then save the image on Drupal's file system, and then set the image as the image for a node. In D7, this was a pretty simple task, but it's causing ...
0
votes
1answer
18 views

How to check if managed_file has uploaded a video and use it in states

I want to disable the submit button in a form for as long as there are no value/uploaded video in a managed_file but I can't seem to find what form name or element property I have to check for in #...
2
votes
1answer
72 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 ...
1
vote
0answers
34 views

File permissions

Recently moved to WSL and Ubuntu and my Drupal 8 project has a specific issue with the JS and CSS cache files. When I click Aggregate js and css in performance the site breaks. Used Drush to update ...
0
votes
1answer
27 views

Token path to file URL, filename, etc.?

I'm writing a Rule that sends an email when a user uploads a file to a node. How would I output the file's URL and filename in the body of the email? First, some things to note: This is an Entityform ...
2
votes
1answer
40 views

Should scripts/*.sh files be executable?

Drupal 7's recommended file permissions don't allow it's /scripts/*.sh files to execute. Should any server user have the ability to run those?
0
votes
1answer
27 views

ExtensionDiscovery::scanDirectory() takes too long

I have been debugging a bit an issue on our platform and I notice that our scanDirectory takes, from time to time, way to long, more than 100seconds. I have been looking at the default.settings.php ...
1
vote
1answer
19 views

File Field related issue / How to hide file size information?

I used CDN option while creating my sub-theme. I find less and sass things pretty confusing since I am someone who haven't mastered the css yet. What I have found out so far is: I can edit some ...
1
vote
1answer
19 views

How can I link the file name to the file?

I created a content type with a "file" field type. This to upload a pdf file. Now I want to create a link to open that specific file, in my twig. If I do this : <div>{{content....
0
votes
0answers
78 views

How to create a 'button' which is linked to a Media Document with custom Link text?

I am trying to create the ability for a content editor to add a button to an entity which links to a Media Document. Essentially the requirements are that we can upload a file and that file is ...
0
votes
1answer
48 views

Private filesystem does fire 403 on every role and file

Like the title might expect I am not able to view any file that i am delivering through the private file system. Only if I bypass the access check via role settings. I tested it a minute ago with a ...
0
votes
0answers
47 views

Private files need to be switchable to public

We have private nodes. Nodes that are just visible for logged in users. These nodes are setup to use a private filesystem. These "private" nodes can also become public if an article is moved ...
0
votes
0answers
19 views

I cannot upload XML files through managed_file

When i try to upload a .blm file in the admin upload page on /file/add, the file is uploaded to the temporary folder, but no file entity is created. Instead, I get this error. Drupal\Component\Plugin\...
0
votes
0answers
17 views

How to get IMCE to view just one S3 bucket folder created by IMCE

I have 700 training courses. I want to to be able to go to a drupal page and access that courses files using only the IMCE module. I like the ability to create folders and download and upload files. I ...
1
vote
1answer
51 views

How do I track a publicly downloaded file?

I am creating a custom module to track the file download time and user id with a file link or path. I have tried multiple modules but the download the file time tracking option is not available. How I ...
0
votes
1answer
30 views

Why there is not loadData() method in FileSystem?

To use the private:// scheme of Drupal 8 I had to : Create a folder outside the docroot folder Implement a $settings['file_private_path'] = '../private-files'; to designate this folder Make sure ...
1
vote
3answers
97 views

How to clear image (or file) field data for specific node programmatically?

I need to clear/remove image (or file) field from specific node. I have before: I want to get after code execution for the field: What code should I use to properly clear image (file) field data?
0
votes
0answers
36 views

How can I download protected files using the REST API?

How can we download the protected files using the REST API by using the BasicAuth? I've tried below code with BasicAuth var settings = { "url": "domain/system/files/guides/docs.pdf&...
1
vote
1answer
35 views

How to render text including video embed field

I have a formatted text field, and am using the video_embed module to allow users to embed video into that field, using the video_embed_wysiwyg submodule. I am then trying to render the field in a ...
0
votes
0answers
17 views

Drupal 7 creating a form field to upload multiple images

I'm creating a from in a custom Drupal 7 module with a field for multiple images, which isn't working as expected. As an experiment, I added a custom field to the user acct settings of type image with ...
0
votes
0answers
18 views

Get upload date of a file

On my Drupal project, for a local cycling club, on the pages that show the different routes we'll be doing there is a link to a gpx file that contains the route details. Since routes change often ...
0
votes
0answers
59 views

How to use parent paragraph or field name in template_preprocess_file_link function?

We created custom theme suggestion for fields links using this code function THEME_theme_suggestions_file_link_alter(array &$suggestions, array $variables) { $route = \Drupal::request()->...
0
votes
0answers
44 views

Upload External File to Drupal File System

Situation I would like to be able to upload files programmatically from an external source to the drupal file system. I was thinking of making a RESTful API that allows me to save external files into ...
0
votes
1answer
117 views

With managed file, dynamically set fileName and #upload_location

In a form I want to bulk upload jpgs renaming them using exif date information and dynamically setting the #upload_location according to the value of a textfield in the same form. I have no problem ...
0
votes
1answer
35 views

Add upload/processing status bar/throbber

I am new to Drupal/web development and I have been trying to create a module to add files upload menu. Once the files are uploaded, they undergo processing and a message is displayed upon completion ...
0
votes
0answers
17 views

Images randomly not found

I have an issue on Drupal 8 with images randomly not found. I am actually not sure if the issue comes directly from Drupal. I am developing for my organisation a website currently quite simple with ...
0
votes
2answers
59 views

File size on View

Is there a way to display the file's size next to it in a View? This is for a File field in Drupal 8. I tried the advice (for D7) here, but I received this error. The handler for this item is broken ...
1
vote
2answers
43 views

Permit only one role to download files

I'm trying to set up a new D8 site. It needs to include some "subscriber only" type functionality. There is one content type which is little more than a title, a file, and one extra field ...
0
votes
1answer
17 views

How would you convert a link to a media item to the file URL in a menu?

I would like to be able to link to media in a Drupal menu and have the link converted to a file url. Is this possible?

1
2 3 4 5
48