By using Elementorforum.com’s services you agree to our Cookies Use and Data Transfer outside the EU.
We and our partners operate globally and use cookies, including for analytics, personalisation, ads and Newsletters.

  • Join the Best Unofficial 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!
elementor official

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 ?
 
elementor official
Last edited:
elementor official
Top