• Join the Best Wordpress and Elementor Support forum

    Provide or get advice on everything Elementor and Wordpress, ask questions, gain confirmation or just become apart of a friendly, like minded community who love Wordpress and Elementor


    Join us!

Allow Download File after form submitting (Custom Form Action)

Nicoduweb

Nicoduweb

New Member
Hello,

I would like to allow user to download a file after submitting a form, without redirect ( I need user stay on the form page).
So i've used Custom form action to add function to the form. ( i can't add link but the page is 'custom-form-action' form developers.elementor.com site)



My last problem is in the run function :

I've tried to start download using readfile, but that doesn't work.

PHP:
public function run( $record, $ajax_handler ) {
 
        header('Content-Type: application/pdf');
        header("Content-Transfer-Encoding: Binary");
        header("Content-disposition: attachment; filename=File.pdf");
        readfile($settings['files_url']);

     }

I suppose i need asynch function ?

Do you know if i can use this function to send file to user browser ?

PHP:
$ajax_handler->add_response_data()

Could you help me please ?
 
Last edited:

Latest Resources

Other Elementor Resources

elementor official

Still stuck? Ask the forum

Post your question with a screenshot and a link if you can, and a member will usually reply within a day. Free to join, no sales pitch.

Create a free account
Top