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