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
-3
votes
0answers
19 views

What is a safe way to remove the web.config file from my project? [closed]

not using a windows server I'm asked to remove the web.config file One possible fix is to restrict access to the file. Thank you, Mary
1
vote
1answer
31 views

Why can't admin access private file?

I have a file field as part of a Paragraph. The Paragraph is attached to a node bundle. Each paragraph can hold a single file. I have added the same file to the node (each in its own paragraph) ...
-1
votes
1answer
25 views

Download Single Webform Submission CSV

I would like to download the webform submissions one by one. Currently the core of Webform owns to download all submission data to a CSV. Webform -> Result -> Download How to download one ...
0
votes
0answers
19 views

How can I change the “sites/default” into “web/sites/subsite” on the new location?

I have moved the content (files and database) of my "traditional" site (no composer, single site, using sites/default/files folder ) to a subsite on a multi-site that is created using ...
0
votes
0answers
16 views

How to get the file destination from a content type's field_image to upload programatically

I have a cron job that goes and grabs content from another resource and uploads it into my drupal site, and this includes a link an image that I retrieve and upload into my S3 file system. My site's ...
0
votes
0answers
16 views

How to decode base64 image using pre save hook?

I am uploading image using jsonapi. But here the data is base64 format (As per requirement). Uploading to media entity. So I need to write a hook media entity pre save so that file uploaded should be ...
1
vote
0answers
43 views

How can I have the file upload destination private by default?

Currently Webform file component uses public files as default upload destination. This is probably because private files path is not always available if not configured in Drupal settings correctly. ...
1
vote
0answers
27 views

How to programmatically update a file uri in a node

I'm programmatically moving a pdf file and then trying to update the uri in the node. Here's my code: $node = \Drupal\node\Entity\Node::load($nid); $entity = $node->field_pdf->entity; if ($...
0
votes
1answer
28 views

How to send dynamic content as an attachment file in email?

Normally we send files as attachments in the email if they are stored in the file system. $file->uri = 'sites/default/files/file_name.pdf'; // File path $file->filename = 'file_name.pdf'; //File ...
0
votes
1answer
90 views

Auto delete temporary files after 15 seconds of creation

The default setting given to delete temp files is after 6 hours minimum. I have users upload files and I want that if it has temp status, delete it after 15 secs. Tweaking the file module code is ...
0
votes
0answers
14 views

How can I assign multiple files to the same field in a migration lookup?

In a first migration step, I import files. Therefore, I read a csv file, containing filenames and attributes about the files. Files can share the same attribute like so: file,attribute,... ex1.pdf,666,...
1
vote
1answer
41 views

How can I upload and read an unmanaged file?

On a custom form I have a file field. Having chosen the file and clicked Submit, I'm trying to find how to access and read the uploaded file. I have no need to move or save it, I simply need to open ...
0
votes
0answers
54 views

How to work around check for `sites/default/files` during Drupal installation, if you're not planning on using it?

I'm working with a server where I don't have shell access and I've dropped the database in an attempt to reinstall Drupal (having run into issues with a failed deployment). When I try to step through ...
0
votes
0answers
34 views

After the update 8.7.14 to 8.8, the File module causes error when uploading a file

After updating Drupal 8.7.14 to 8.8, I have a problem with the File module: When I upload a file, I get the This value cannot be zero error message. The file is however present in the site/default/...
2
votes
0answers
33 views

Theming a file link by adding custom file name suggestions

I want to display a bunch of data inside a view table, where each dataset has up to three different files. The user should be able to download these files by clicking a custom button or image in this ...
0
votes
0answers
15 views

Error copying file. Is there a permissions issue?

I have a process that fetches a file, then moves it (overwriting if already exists). The copy part fails, and I cannot determine why. Here is some PHP I am using to reproduce the issue I am seeing (...
-2
votes
1answer
56 views

Why doesn't file load by URI?

I have a file URI something like private://somefolder/myfile.pdf. Certain users don't have access to the file so I am trying to change that using hook_file_download($uri). In that code I need to load ...
0
votes
0answers
28 views

File not found while retrieve the path after submit form

I have upload a csv file. It get uploaded on the physical path but while retrieve the path I get error file found. File get uploaded in sites/default/files/data_file/myfile.csv After print variable $...
0
votes
0answers
7 views

How to display uploaded files with uncommon extensions using file field?

I have a standard Drupal file field to upload different files via this field. I have set the "allowed extensions" to: txt, pdf, doc, docx, pages, key, ppt, pptx, numbers, xls, xlsx, csv, tar,...
1
vote
0answers
27 views

Problems with file migration

I'm in the process of migrating a fairly large old site that has been migrated from Drupal 6 to Drupal 7, and now to Drupal 8. There are a few issues about getting this done, but I have a grip on most ...
0
votes
1answer
99 views

How can I fix this error and upload files?

I have a simple form with just a field to upload a file on a Drupal 8 site using the Webform module 6.0.1. If I test the form using webforms test tool, the file gets uploaded fine, it displays the ...
0
votes
0answers
26 views

Get the URL to use it in an <a> tag in a file field

I'm looking to print out the url for a file in a Drupal File field in the twig template. I'm doing this inside a paragraph twig file. I've followed a similar answers on stack overflow but to no joy. ...
1
vote
1answer
70 views

Permanent Deleting of files still doesn't work for me (make_unused_managed_files_temporary = true)

make_unused_managed_files_temporary didn't work for me. I am using Drupal backend for the REST API frontend application. Thats how the File input looks (because I am not sure if that setting is for ...
0
votes
0answers
18 views

Ajax callback to create paragraphs on form

I'm trying to create a way that an end user can upload a csv into a node form and it automatically extracts the content and then creates paragraphs in the form. I have created a custom managed file ...
0
votes
1answer
38 views

Migration with custom files path

I have to migrate a website from Drupal 7 to Drupal 9. My Drupal 7 files were located in this directory : sites/mywebsite/files In Drupal 9, files will be located in this directory : sites/default/...
2
votes
0answers
28 views

Cannot delete file due to empty entity reference

I have been asked to delete a file that has incorrect legal information on it from a website so it has to go. My users could not do it. The site is running drupal 8.9.13 and I have installed the ...
0
votes
0answers
24 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 ...
0
votes
1answer
94 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
42 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
76 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
47 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
32 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 ...
0
votes
0answers
42 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
16 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
2answers
97 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
38 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
29 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
15 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
43 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
39 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
61 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
33 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
81 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
59 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
38 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
30 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
216 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
38 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
83 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
42 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?

1
2 3 4 5
49