File Metadata Microservice...why use a server?

File Metadata Microservice...why use a server?

Posted Sep 16, 2016, 2:55 PM UTC

33
Jon1764OP•

So I am working through this project and all it is basically asking me to do is upload a file to the server, calculate the file size, and return it back to the client.

What is the point of doing that when the native HTML5 file upload dialog gives the filesize when you select the file?

I have the file dialog:

<input id="upload-file" type="file" onChange={this.handleFileUpload}/>

as soon as you select the file, it stores some metadata in the HTML control and you can retrieve it using javascript without even touching the server.

1
ucshadow•

The point of the challenge is not to actually get the file size from a file, it is to understand how file upload works on a server and also reinforce your knowledge about API's.

3
SaintPeter74mod•

You're right - the service itself is not very helpful or useful. However, the skills that you need to learn to do it are quite useful. You learn how to handle file uploads, calculate file size, etc.

Imagine that you were writing some image gallery software? You might want to set an upper limit on file size. Any site that has user generated content probably needs to check file sizes.

1