Skip to content

What could be reason the file upload feature of component isn't working? #8192

Closed Answered by Ifriqiya
Ifriqiya asked this question in Help/Questions
Discussion options

You must be logged in to vote

I found out what the issue was and it's not a vue problem. It has to do with the Inertia form method I was using and the correct usage of http methods. It turns out I shouldn't use a put method for file uploads. Changing this portion of my code resolved the issue:

const form = useForm({
  _method: "PUT",
  first_name: user.value.first_name,
  last_name: user.value.last_name,
  email: user.value.email,
  mobile_phone_number: user.value.mobile_phone_number,
  address: user.value.address,
  photo: null,
  signature: null
})

const updateProfileInformation = () => {
  photo.value ? (form.photo = photo.value.files[0]) : null
  signature.value ? (form.signature = signature.value.files[0]) : null

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Ifriqiya
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Ifriqiya
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants