File upload with response #487
-
Hello, I am currently trying to upload files via Inertia.js / Laravel in combination with Vue2. The file upload itself already works using this: this.$inertia.post('/file-upload', formData, {
...options
}); But I am not able to get a response about: was file upload successfully or did errors occured? As mentioned in inertia.js-Documentation (here) I should use Dear regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Okey, I see my question is a duplicate of #453 and there is already a Pull Request working on it inertiajs/inertia-laravel#206. This leads me to the next question: when this will be merged and usable for all? Changed the file in core for now but you know... it's not recommended |
Beta Was this translation helpful? Give feedback.
-
Alright, so, usually the straight-forward solution here is to use the same URL for uploads, in which case the URL's will remain the same and the history doesn't get updated. However, I can totally imagine situations in which this isn't the case for whatever reason, and in those situations this is what I would do:
|
Beta Was this translation helpful? Give feedback.
Alright, so, usually the straight-forward solution here is to use the same URL for uploads, in which case the URL's will remain the same and the history doesn't get updated.
However, I can totally imagine situations in which this isn't the case for whatever reason, and in those situations this is what I would do:
Redirect::back()
to go 'back' to the page you're already on. This will prevent the URL from being updated, as well as the history state from being changed.Inertia::render()
call (or in the global middleware), grab the state from the session (step 2) and render it.