Paul Greinke Posted May 5, 2022 Share Posted May 5, 2022 Hi there. I was wondering, if there was a best practice to handle file uploads outside of the admin frontend. For example if I had a form were a guest user can put some data including a file. I would like to upload the file on input and process it later on form submit. The problem is, that the user also could choose not to submit the form. That would lead to a bunch of unused uploads. In one project I use the PHP session. I simply create a folder named by the session id. Each time the user enters the page with the file upload I initially wipe all the data form the session folder. But this already does not work, if the user had the form opened in two separate browser tabs. Is there maybe a way to hook into the session invalidation process? Than way I could simply delete the session folder as soon as the session expires. I know I could use a cronjob or even lazycron, but I don´t find this a clean way for my case. Another idea of mine was to use some kind of caching folders. I saw that for example FormBuilder does it that way. But I did not find much information about how the caching works in ProcessWire. When is the cache cleared and how much control do I have? Maybe there is a even better and more convenient way to do it. I'll take any idea. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now