1

I’m in the beginning stages of planning out my final Capstone project for my Bootcamp.

Two of the features I would like to include are the ability to upload:

  1. Audio
  2. Video

I will be using React.JS for Front-End and Python / Django for server side.

Any suggestions or recommendations for how to approach these upload features?

I’m currently beginning researching how to do this.

jamesscott
  • 11
  • 1

1 Answers1

0

you can use html tag input on react

const [file , setFile] = useState();

<input
type="file"
id="fileInput"
onChange={(e) => setFile(e.target.files[0])}
/>

after that you can use FormData() to create file format then send file to api

        const data = new FormData();
        const filename = username + "_" + file.name;
        data.append("name", filename);
        data.append("file", file);
        try {
            api.uploadFile(data);
        } catch (error) {
            console.log(error);
            
        }

at backend ( django ) I don't know how to handle file requset but you can find it easily . At react side you can use codes at top .