How to prevent Kirby from writing an uploaded file to disk?


I’m working on a plugin that sends uploaded images to a remote bucket while keeping a small “placeholder” image with the uploaded filename on disk (for Kirby to function properly). Essentially, this: Hosting on AWS Elastic Beanstalk and S3

Question: Is there a way to prevent Kirby from writing the uploaded file to disk? Since I’ll be copying over a placeholder there’s no need for Kirby to write the uploaded file. Otherwise, the only approach I can think of is updating it (after it’s written), as described here: Preserving original filename after panel upload

Grateful for any insight!

I’d prefer to prevent the initial write, since it’s unnecessary.

PHP always saves uploaded files on disk and there is no way to disable that. Kirby then only moves the file from the temporary location to the content dir, which is quite fast on most file systems.

Thanks @lukasbestle.

I realized that handling everything in the file.create:after hook is actually beneficial (rather than the file.create:before) hook, since that way all of Kirby’s validation handling stays in tact.

Hi @isaac,

Have you had any luck with building the plugin? I am currently looking into a solution to store the images on an S3 bucket. :slight_smile: