Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-09-09 16:44:26

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

file_save step doesn't seem to be working for me.

I have this callback registered:

register_callback('rlt_amazon_file_save', 'file_save', 'file');

defined as:

function rlt_amazon_file_save($event, $step, $data)
{
  print_r($data);
  echo 'saved';
  return 'saved';
}

After I upload a file, none of those output occur anywhere. I am trying to take the uploaded file and pass it over to my Amazon S3 account.
I am obviously doing it wrong or not realizing thinking incorrectly.

Image has an ‘image_uploaded’ event, why doesn’t the file have one too?

Thanks
Rich

Offline

#2 2018-09-09 19:06:53

etc
Developer
Registered: 2010-11-11
Posts: 2,936
Website

Re: file_save step doesn't seem to be working for me.

Hi, you can try site.update event with file_saved (_replaced, _uploaded, _created, _updated) steps. But note that file upload response in 4.7 is sent as some JS code in async mode.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#3 2018-09-09 20:35:55

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

Re: file_save step doesn't seem to be working for me.

Hello,

Thanks for the direction. However, I am not sure if I am using this correct.
The installed version I am using is 4.6

I looked through the developer docs and found site.updated which I assumed is the event you meant.

register_callback('rlt_amazon_file_save', 'site.updated', 'file_save');

This still shows no output. It could be im looking in the wrong place.
I am simply expecting output on the resulting file page after its done.

Thank you
Rich

Offline

#4 2018-09-09 20:39:28

etc
Developer
Registered: 2010-11-11
Posts: 2,936
Website

Re: file_save step doesn't seem to be working for me.

Try file_saved step (not file_save).

Edit: but it’s definitely site.update and not site.updated, so

register_callback('rlt_amazon_file_save', 'site.update', 'file_saved');

etc_[ query | search | pagination | date | tree | cache ]

Offline

#5 2018-09-11 00:24:13

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

Re: file_save step doesn't seem to be working for me.

So after a lot of uploads, I decided to click ‘Save’ button – which saves any changes to the data.

Sure enough – the output was there.
I kept expecting the output to be on the page after the upload happens.

So I thank you for you help on this one!
Rich

Offline

Board footer

Powered by FluxBB