Uploading multiple files error

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

if uploaded_file:
for uploaded_files in uploaded_file:
file_path = os.path.join(uploaded_files.name, uploaded_files.name)
loader = UnstructuredFileLoader(file_path)
data = loader.load()

in my above code showing following error for any file uploading other than current working directory:
FileNotFoundError: [WinError 3] The system cannot find the path specified: ‘file.pdf\file.pdf’

Please help me out.Thank You.

Hi @Sourav_Barua

In the input parameters for os.path.join() it seems that you’ve specified uploaded_files.name twice

As a result, you are seeing the error file.pdf\file.pdf where you have the file names as the file path and the file name, respectively. I would recommend changing the first parameter to the file path such as os.getcwd() or ./ (as in current directory).