This topic is locked
[SOLVED]

Custom button - file upload

1/25/2025 8:13:24 AM
PHPRunner General questions
P
Pietro Arcadio author

Hi to everyone,
In phprunner 10.91 can i add a custom button for upload a file, execute some PHP code and the delete the file? i want add the button in view page or in every row of datagrid in list page.
thanks ti all

Admin 1/25/2025

Yes, it certainly can be done but will not be easy to write the code for this task. It will be much easier just to use the built-in functionality here like Inline Add or Edit.

P
Pietro Arcadio author 1/25/2025

can you explain to me in a nutshell what I should do? and instead how can I do the same thing with the in line edit function? I would like to avoid adding a field to the table where to save the path of the uploaded file. if possible I would like to just upload a file, get the ID of the record on which I perform the operation, execute some php code that I have already written and then delete the file

Admin 1/27/2025

Implementing your own upload function will requires tons of coding.

With Inline Edit it should be easier. Just make sure that the field where you upload files is visible on the List page and enable Inline Edit functionality. You can turn it on on 'Choose Pages' screen in the software.

P
Pietro Arcadio author 1/28/2025

my goal is to parse a csv file and query the database, phprunner import function is not enough, the csv file is quite complex and i have already written the code to parse it. for my purpose is it appropriate to use the After record update event?

Admin 1/28/2025

I think it will work with AferRecordUpdated event. You can get the name of the file there, open it, process it and delete.

P
Pietro Arcadio author 1/31/2025

hello everyone, in the end I added a text field to host the path of the uploaded file and used the before record update event to run my code (converting an excel file to CSV, processing the data and inserting the records into two separate tables in relation to each other) thanks for your attention, best regards