Hi There,
I am putting together an applications/single_page process which needs to extract Activity Details from an external database and then allow logged in users the ability to upload one or more files (photos, trip reports etc) to be stored with that Activity.
The applications/single_page process has two form blocks - the first one calling another single_page php script to extract the Activity from the external database and the second form block prompting the user to upload multiple files and calling the Controller PHP script using this method: , which uploads the files into File Manager and updates file description attributes etc.
If I run the single page html/php WITHOUT submitting any fields from the first form block (), the Controller PHP file upload process works perfectly. If I run the single page html/php again and submit fields via the first form, I get a 404 Page not found error when I try to upload files using the second block and call the Controller php.
I hope this makes sense - any thoughts on what might be happening ?
Thanks & Regards,
Jeff.
Further info abouth the form action/methods: First form: form method=“post” action=“/home/return_details” autocomplete=“off”.
Second form: form method=“post” enctype=“multipart/form-data” action="<?=$view->action(‘submit’)?
Jeff.
Concrte Version Information: 9.4.7.
PHP: 8.3
Jeff.
Hi All,
I worked around this problem by calling the second process via a button invoking a new single page PHP file which then called the Controller PHP of the same name.
Jeff.
I’ve actually done something simliar in one of my programs. The way i did it:
- I moved all my “worker” functions to stand alone modules/class which i stored in the [packge]/src directory
- My blocks & single pages access those function to handle the CRUD functions
- My single pages always use id=0 indicating create/new so Create/Update always use the identical code. This works really well with orm because i can just initiate the class on it’s own, all my defaults defined in the class, and id=0 , means create new
- for external submissions, i did a route into my utility function CRUD classes
This keeps the blocks/single pages relatively clean. Happy to share more details on any of this if it’s helpful