ttbb Posted January 29 Share Posted January 29 In PW all images are uploaded under /site/assets/files/pageID to match a bunch of media of an old website i'd like to integrate customizable upload subfolders for different templates or fields like: /site/assets/blog-images/pageID/ or /site/assets/portfolio/pageID/hero-images/ and /site/assets/portfolio/pageID/detail-images/ i've found the ProcessCustomUploadNames module ( https://processwire.com/modules/process-custom-upload-names/ ), but this only can change the file names, not the upload path. then i found this, but i'm not sure about it being helpful in this case: is there a hook which can eventually intervene when i'm uploading an image? Link to comment Share on other sites More sharing options...
ttbb Posted January 30 Author Share Posted January 30 (edited) i did some additional research and ended with having the idea to check the $pages->saveFieldReady() hook as a place where i could change the upload path (https://processwire.com/api/ref/pages/save-field-ready/). i'm not sure whether or when this event happens when i upload an image: is the upload action itself (choosing an image via file dialog or drag and drop) already starting the upload a save process for an image file or is this happening when save the entire page? where can i find informations about the detailed file/image upload process? maybe the WireUpload class (https://processwire.com/api/ref/wire-upload/) can be useful here? especially the WireUpload::setDestinationPath() method? (https://processwire.com/api/ref/wire-upload/set-destination-path/) has anyone built something similar already? Edited January 30 by ttbb 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