Question

How to upload large(mb/gb) of video files from client to app server?

The solution as of now I know is pretty simple and widely used is to break file in chunks at at client side and send http post request for each chunk.

Now if I take this to distribute environment, where a app server getting lot of parallel requests from different clients for different chunks or may be same user uploading different files from different endpoints(Browser/app etc.), So how does server know which chunk is for which file?Since server has not generated any filename or fileId on itself ,it has to rely on client to provide this, so does that mean client has to provide a file name and then server will merge all the chunks with same file name per user basis?Does that mean that a user cannot upload two videos with same name from his/her account?

The app server will here generate metadata for each chunk and put the chunk to s3

Map this use case to youtube upload.

Was it helpful?

Solution

On the first request, the server creates a random string for the file, and tells the client. On the subsequent requests, the client sends the same random string back so the server knows it's about the same file.

Exactly the same way S3 works.

Licensed under: CC-BY-SA with attribution
scroll top