St.file_uploader cannot transfer the file to the second object

Hello, everyone. I need your help.

I found that st.file_uploader cannot transfer the file to the second object. My codes are like the following:

uploaded_file = st.file_uploader(“Choose a file”)

dom = minidom.parse(uploaded_file)
per = ET.parse(uploaded_file)

per cannot get anything. XML file has no error. And if I change the sequence to “per, dom”, dom can not get the file.

error: xml.etree.ElementTree.ParseError: no element found: line 1, column 0

Does anyone have some solutions? I appreciate it so much.

I tried, if you upload one file and read it will two function, second function will report error.
one solution is you copy the original file and rename the new file.
and set your code like this:

uploaded_file = st.file_uploader(“Choose a file”, accept_multiple_files=True)

Thank you!