
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.
I suppose i need asynch function ?
Do you know if i can use this function to send file to user browser ?
Could you help me please ?
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: