{"id":25851545,"url":"https://github.com/bitstarr/grav-plugin-upload-cleanup","last_synced_at":"2025-08-09T05:06:59.265Z","repository":{"id":278191333,"uuid":"934744352","full_name":"bitstarr/grav-plugin-upload-cleanup","owner":"bitstarr","description":"Prevents file uploads from being saved permanently if neccassary","archived":false,"fork":false,"pushed_at":"2025-02-18T13:02:05.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-18T14:21:45.322Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitstarr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-18T10:36:49.000Z","updated_at":"2025-02-18T13:02:08.000Z","dependencies_parsed_at":"2025-02-18T14:21:47.236Z","dependency_job_id":"975a0db0-8114-494b-a5a4-debfca2f777b","html_url":"https://github.com/bitstarr/grav-plugin-upload-cleanup","commit_stats":null,"previous_names":["bitstarr/grav-plugin-upload-cleanup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitstarr%2Fgrav-plugin-upload-cleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitstarr%2Fgrav-plugin-upload-cleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitstarr%2Fgrav-plugin-upload-cleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitstarr%2Fgrav-plugin-upload-cleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitstarr","download_url":"https://codeload.github.com/bitstarr/grav-plugin-upload-cleanup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241367930,"owners_count":19951449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-01T13:17:40.114Z","updated_at":"2025-03-01T13:17:40.645Z","avatar_url":"https://github.com/bitstarr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Upload Cleanup Plugin\n\nThe **Upload Cleanup** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). It prevents file uploads in forms from being saved permanently if you only need them as email attachment for example.\n\n## Configuration\n\nBefore configuring this plugin, you should copy the `user/plugins/upload-cleanup/upload-cleanup.yaml` to `user/config/plugins/upload-cleanup.yaml` and only edit that copy.\n\nThere is only the option to enable/disable it.\n\n```yaml\nenabled: true\n```\n\n## Usage\n\nIn your form configuration set the destination of the uploads you don't want to persist to `tmp/uploads` and add `upload.cleanup: true` to the `process` object. Make sure the upload is noted after other processings.\n\n```yaml\nform:\n  name: application\n  action: \"#application\"\n  classes: form\n  fields:\n\n    …\n\n    file:\n      label: curriculum vitae\n      type: file\n      multiple: false\n      filesize: 4\n      destination: tmp/uploads\n      avoid_overwriting: true\n      accept:\n        - application/pdf\n        - application/x-pdf\n        - text/plain\n        - image/jpeg\n        - application/msword\n        - application/vnd.openxmlformats-officedocument.wordprocessingml.document\n        - application/vnd.oasis.opendocument.text\n\n  …\n\n  process:\n    email:\n      from: \"{{ config.plugins.email.from }}\"\n      from_name: \"{{ form.value.name }}\"\n      to: \"{{ config.details.jobs_email }}\"\n      reply_to: \"{{ form.value.email }}\"\n      subject: \"New Job Application\"\n      body: \"{% include 'email/application.txt.twig' %}\"\n      content_type: 'text/plain'\n      attachments:\n        - 'file'\n    upload:\n      cleanup: true\n\n\n```\n\nThe plugin basically deletes all files inside the `tmp/uploads` when it is called to process.\n\n\u003e [!WARNING]\n\u003e If the email transmission or any other step in the process list fails, the cleanup will run and delete the content of the tmp/uploads folder in any case.\n\n## Installation\n\nInstalling the News plugin can be done in multiple ways: The manual method lets you do so via a zip file, installation via dependecies and the admin method lets you do so via the Admin Plugin.\n\n### Manual Installation\n\nTo install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `upload-cleanup`. You can find these files on [GitHub](https://github.com/bitstarr/grav-plugin-upload-cleanup) or via [GetGrav.org](https://getgrav.org/downloads/plugins).\n\nYou should now have all the plugin files under\n\n    /your/site/grav/user/plugins/upload-cleanup\n\t\n\u003e NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/bitstarr/grav-plugin-upload-cleanup/blob/main/blueprints.yaml).\n\n### Installation as dependency (skeleton)\n\nIf you don't know this method already, check out this [example of a dependecies file](https://github.com/bitstarr/sebastianlaube/blob/main/user/.dependencies). It can hold all (external) plugins and themes you require to run your project. When running `bin/grav install` all these will get downloaded and correctly placed automatically.\n\nAdd the following to your `.dependecies` file:\n\n```\n    upload-cleanup:\n        url: https://github.com/bitstarr/grav-plugin-upload-cleanup\n        path: user/plugins/upload-cleanup\n        branch: main\n```\n\n### Admin Plugin\n\nIf you use the Admin Plugin, you can install the plugin directly by browsing the `Plugins`-menu and clicking on the `Add` button.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitstarr%2Fgrav-plugin-upload-cleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitstarr%2Fgrav-plugin-upload-cleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitstarr%2Fgrav-plugin-upload-cleanup/lists"}