This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

lucas.sanner54070
lucas.sanner54070

the form:

{{ form_ajax('onExport', {flash: ''}) }}
      <button type="submit" class="btn btn-info">Export</button>
{{ form_close() }}

the component:

public function onExport()
{
     // Generates the file here...

     return \Redirect::to('export.php')->with('file', $file);
}

the page:

function onStart(){ 
 $file = Session::get('file');

 header('Content-Description: File Transfer');
 header('Cache-Control: no-cache, must-revalidate'); // HTTP/1.1
 header('Expires: 0');
 header('Content-Transfer-Encoding: binary');
 header('Content-length: '.$file->file_size);
 header('Content-Disposition: attachment; filename="'.$file->file_name.'"');
 readfile($file->getLocalPath());
 exit;
}

It works but after the user has downloaded their file, the progress bar doesn't go. It looks like if the Ajax request was working indefinitely.

How can I stop this process ?

Last updated

mjauvin
lucas.sanner54070
lucas.sanner54070

I've reproduced the exact same code but I still have the same problem.
What can I do ?

Last updated

mjauvin
mjauvin

I remember now there has been a fix for this in October's code.

see https://github.com/octobercms/october/pull/5321

You'd need to update to latest 1.1.x branch using composer to get this fix.

ref. https://octobercms.com/docs/console/commands#console-install-composer
check the note about an existing installation at the bottom of that section

Last updated

lucas.sanner54070
lucas.sanner54070

Thanks for your reply, it saves me a couple of extra hours of investigation.
Is it safe to update to the 1.1 version ?
Why the current version on the official website is still 1.0.xxx ?

mjauvin
mjauvin

Yes, perfectly safe. Make sure you set cms.disableCoreUpdates to true in config/cms.php

The marketplace needs to be updated to support multiple branch.

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.