From 7f477ec0345de246d69e32e2e77fc464e20215a6 Mon Sep 17 00:00:00 2001 From: richard-dds Date: Thu, 15 Aug 2019 14:47:19 -0400 Subject: [PATCH] Fix "request entity too large" when uploading TO PDF Do this by setting disabled="true" on the file input element after selecting the file, and re-enabling it if the file is removed. This prevents the file from actually being sent to the server, since we're not using it there anyway. --- js/components/upload_input.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/components/upload_input.js b/js/components/upload_input.js index 273c1d20..6a1db083 100644 --- a/js/components/upload_input.js +++ b/js/components/upload_input.js @@ -64,12 +64,12 @@ export default { methods: { addAttachment: async function(e) { const file = e.target.files[0] - const response = await this.uploader.upload(file, this.objectName) if (response.ok) { this.attachment = e.target.value this.$refs.attachmentFilename.value = file.name this.$refs.attachmentObjectName.value = this.objectName + this.$refs.attachmentInput.disabled = true } else { this.showErrors = true this.uploadError = true @@ -89,6 +89,7 @@ export default { this.attachment = null if (this.$refs.attachmentInput) { this.$refs.attachmentInput.value = null + this.$refs.attachmentInput.disabled = false } this.showErrors = false this.uploadError = false