BLUR 8
This commit is contained in:
parent
ec7c3861dd
commit
02d712614f
@ -24,21 +24,19 @@ class State(rx.State):
|
||||
|
||||
# The images to show.
|
||||
img: list[str] = []
|
||||
|
||||
async def handle_upload(self, files: list[rx.UploadFile]):
|
||||
"""Handle the upload of file(s).
|
||||
|
||||
Args:
|
||||
files: The uploaded files.
|
||||
"""
|
||||
for file in files:
|
||||
upload_data = await file.read()
|
||||
outfile = rx.get_asset_path(file.filename)
|
||||
|
||||
|
||||
# Save the file.
|
||||
with open(outfile, "wb") as file_object:
|
||||
file_object.write(upload_data)
|
||||
|
||||
|
||||
# Update the img var.
|
||||
self.img.append(file.filename)
|
||||
self.img = self.img
|
||||
|
Loading…
Reference in New Issue
Block a user