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.
This commit is contained in:
parent
b49d926d7a
commit
7f477ec034
@ -64,12 +64,12 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
addAttachment: async function(e) {
|
addAttachment: async function(e) {
|
||||||
const file = e.target.files[0]
|
const file = e.target.files[0]
|
||||||
|
|
||||||
const response = await this.uploader.upload(file, this.objectName)
|
const response = await this.uploader.upload(file, this.objectName)
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
this.attachment = e.target.value
|
this.attachment = e.target.value
|
||||||
this.$refs.attachmentFilename.value = file.name
|
this.$refs.attachmentFilename.value = file.name
|
||||||
this.$refs.attachmentObjectName.value = this.objectName
|
this.$refs.attachmentObjectName.value = this.objectName
|
||||||
|
this.$refs.attachmentInput.disabled = true
|
||||||
} else {
|
} else {
|
||||||
this.showErrors = true
|
this.showErrors = true
|
||||||
this.uploadError = true
|
this.uploadError = true
|
||||||
@ -89,6 +89,7 @@ export default {
|
|||||||
this.attachment = null
|
this.attachment = null
|
||||||
if (this.$refs.attachmentInput) {
|
if (this.$refs.attachmentInput) {
|
||||||
this.$refs.attachmentInput.value = null
|
this.$refs.attachmentInput.value = null
|
||||||
|
this.$refs.attachmentInput.disabled = false
|
||||||
}
|
}
|
||||||
this.showErrors = false
|
this.showErrors = false
|
||||||
this.uploadError = false
|
this.uploadError = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user