Home PUBLIC Questions Tags Users Companies COLLECTIVES Collectives™ on Stack Overflow – Centralized & trusted content around the technologies you use the most. TEAMS Create free Team unable to find the path for uploading a file using streamlit python code

Im writting a simple python application where the user selects a file from their local file manager and tries to upload using strealit

Im able to succesfully take the file the user had given using streamlit.uploader and stored the file in a temp directory from the stramlit app folder but the issue is i cant give the path of the file of the file stored in the newly created directory in order to send the application into my gcp clouds bucket

Adding my snippet below any help is appreciated :slight_smile:

def main():
  if file is not None:
    file_details = {"FileName":file.name,"FileType":file.type}
    with open(os.path.join("tempDir",file.name),"wb") as f: 
    st.success("Saved File")
    print (cwd+file.name)
file_dir= ("tempDir")
def upload():
                file_name = os.path.join(file_dir, file.name)
                st.write (file_name)
             st.session_state["upload_state"] = "Saved successfully!"
               object_name_in_gcs_bucket = bucket.blob("gcp-bucket-destination-path"+ file.name)
st.write ("Youre uploading to bucket",bucketName)
st.button("Upload file to GoogleCloud", on_click=upload)
if __name__ == "__main__":

ive tried importing the path of the file using cwd command and also tried os library for file path but nothing worked

Thanks all for response after days of strugle atlast ive figured out the mistake im making
i dont know if im right or wrong correct me if im wrong but this worked for me

      object_name_in_gcs_bucket = bucket.blob("path-to-upload"+file.name)

changing the , to + between the filepath and filename made my issue solve

sorry for the small issue

happy that i could solve it