Skip to content

How to interact with files on the server? #1547

Answered by gbj
Amirhosein-GPR asked this question in Q&A
Discussion options

You must be logged in to vote

This is kind of a "wrong tool for the job" situation. Leptos is a UI framework. If you're trying to serve a static file, you should use the appropriate tool for serving static files for whichever server you're using. For Axum, for example, this would be tower_http::services::ServeFile.

Every one of the Axum examples and the Axum starter also include a handler for serving static files or a 404.

Your question about uploading files is completely separate. The search term you want here is "multipart form upload." A quick search gave me a useful article.

Question 3 (a progress bar) does touch on UI more. You can use the <progress> HTML element with a signal that tracks how much of the file upl…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Amirhosein-GPR
Comment options

@Amirhosein-GPR
Comment options

Answer selected by Amirhosein-GPR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants