Filesharing


Example heading with h2 size

Example heading with h3 size

Following is sample java code.

int i = 10;
if(i>0){
    System.out.println('positive');
}

import os
import streamlit as st

Directory to store uploaded files

FILE_DIR = "shared_files"
os.makedirs(FILE_DIR, exist_ok=True)

st.title("Team File Sharing App")

File upload section

st.header("Upload a File")
uploaded_file = st.file_uploader("Choose a file to upload", type=None)
if uploaded_file:
file_path = os.path.join(FILE_DIR, uploaded_file.name)
with open(file_path, "wb") as f:
f.write(uploaded_file.getbuffer())
st.success(f"File '{uploaded_file.name}' uploaded successfully!")

File download section

st.header("Shared Files")
files = os.listdir(FILE_DIR)
if files:
for file_name in files:
file_path = os.path.join(FILE_DIR, file_name)
with open(file_path, "rb") as f:
st.download_button(label=f"Download {file_name}", data=f, file_name=file_name)
else:
st.info("No files uploaded yet.")