Skip to content

File upload with response #487

Answered by claudiodekker
jasonbdt asked this question in Help
Discussion options

You must be logged in to vote

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:

  1. Make an upload request (as you're already doing).
  2. Flash the success state to the session.
  3. Use 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.
  4. In the Inertia::render() call (or in the global middleware), grab the state from the session (step 2) and render it.
  5. Use your view …

Replies: 2 comments 2 replies

Comment options

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

Comment options

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

Answer selected by jasonbdt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants