Skip to content

Commit d81414c

Browse files
authored
Update upload.md - update UploadFile.filename to UploadFile.name (#1356)
Following the current version of this tutorial returns a Deprecation Warning: DeprecationWarning: UploadFile.filename has been deprecated in version 0.7.1. Use UploadFile.name instead. It will be completely removed in 0.8.0.
1 parent afd12b4 commit d81414c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/library/forms/upload.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ class State(rx.State):
5656
"""
5757
for file in files:
5858
upload_data = await file.read()
59-
outfile = rx.get_upload_dir() / file.filename
59+
outfile = rx.get_upload_dir() / file.name
6060

6161
# Save the file.
6262
with outfile.open("wb") as file_object:
6363
file_object.write(upload_data)
6464

6565
# Update the img var.
66-
self.img.append(file.filename)
66+
self.img.append(file.name)
6767

6868

6969
color = "rgb(107,99,246)"
@@ -121,14 +121,14 @@ class State(rx.State):
121121
"""
122122
current_file = files[0]
123123
upload_data = await current_file.read()
124-
outfile = rx.get_upload_dir() / current_file.filename
124+
outfile = rx.get_upload_dir() / current_file.name
125125

126126
# Save the file.
127127
with outfile.open("wb") as file_object:
128128
file_object.write(upload_data)
129129

130130
# Update the video var.
131-
self.video = current_file.filename
131+
self.video = current_file.name
132132

133133

134134
color = "rgb(107,99,246)"
@@ -197,14 +197,14 @@ class State(rx.State):
197197
"""
198198
for file in files:
199199
upload_data = await file.read()
200-
outfile = rx.get_upload_dir() / file.filename
200+
outfile = rx.get_upload_dir() / file.name
201201

202202
# Save the file.
203203
with outfile.open("wb") as file_object:
204204
file_object.write(upload_data)
205205

206206
# Update the img var.
207-
self.img.append(file.filename)
207+
self.img.append(file.name)
208208

209209

210210
color = "rgb(107,99,246)"

0 commit comments

Comments
 (0)