Home › Forums › Quform WordPress › Download file after submit
- This topic has 4 replies, 2 voices, and was last updated 1 year, 1 month ago by oivanr.
- January 4, 2022 at 10:19 pm #33866
I am working in a form that get basic user information, record it in a table and after must download an apk file.
I already record the information
$current_user = wp_get_current_user();
$usuarioLogin = $current_user->user_login;
$dbTable = ‘wp_pilas_estudiantes’;
$fechaHoy = date(‘Y-m-d’);
$fechaVenc = time() + (5 * 24 * 60 * 60); // 5 días por 24 horas * 60 minutos * 60 segundos
$camposAfectados = [‘stdnt_codPais’ => $form->getValue(‘quform_38_14′),’stdnt_telefono’ => $form->getValue(‘quform_38_18’), ‘stdnt_usuario’ => $form->getValue(‘quform_38_3’),
‘stdnt_nombres’ => $form->getValue(‘quform_38_26’), ‘stdnt_apellidos’ => $form->getValue(‘quform_38_27’), ‘stdnt_licGrado’ => $form->getValue(‘quform_38_39’),
‘stdnt_clg_ID’ => $form->getValue(‘quform_38_69’), ‘stdnt_secc_ID’ => $form->getValue(‘quform_38_70’), ‘stdnt_registro’ => $form->getValue(‘quform_38_71’),
‘stdnt_licencia’ => $form->getValue(‘quform_38_72’), ‘stdnt_lic_venc’=>date(‘Y-m-d’,$fechaVenc), ‘usuario’=> $usuarioLogin];
But when I try to dowload the file true php is doesn’t work, because it keeps open the file and don’t download anything, just like it starts to dowloand but never ends.
$file = ‘http://127.0.0.1/pilas/wp-content/uploads/2022/01/pilas.apk’;
header(‘Content-Description: File Transfer’);
header(‘Content-Disposition: attachment; filename=’.basename($file));
header(‘Cache-Control: must-revalidate, post-check=0, pre-check=0’);
header(‘Content-Length: ‘ . filesize($file));
Can you help me please.
Thanks in advanceJanuary 5, 2022 at 9:51 am #33868AllySupport Staff
You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
February 16, 2022 at 6:09 pm #33997
- This reply was modified 1 year, 2 months ago by Ally.
I didn’t work on this until now. That’s why I didn’t tell you the advance.
Your solution redirecting the page is very good, it download the file, the problem now is that the form don´t finish the process (send you the image of the rounding circle working).
What I mean the form is not finishin is
a) Confirmation-> redirect to a custom URL: the file is dowloaded but the form keeps the information and don´t let to intoduce new information, The circle keeps rounding.
b) Confirmation-> display a message and redirect to a custom URL: the file is downloaded, a message is displayed but don’t clear the fields and don’t let to introduce new information.
I can’t give you access to the form because I am working in a local host previous to up the form to my website.
What do you think is happenning?
Thanks in advance.
Attachments:You must be logged in to view attached files.February 18, 2022 at 10:08 am #34005AllySupport Staff
You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.March 1, 2022 at 10:16 pm #34064
- You must be logged in to reply to this topic.