I'm trying to redirect at the end of the saveasset function in init().
This is my code:
craft()->on('assets.saveAsset', function (Event $event) {
// a lot of code here ##########################
//#############################################
//at the end:
craft()->request->redirect('myurl.com');
}
When I save an asset with the redirect function at the end I get the following alert:
Upload failed for filename.csv.
The upload works when I leave the redirect out.
Thanks!