# random


10/25/2017, 12:22 PM
Guys I have a quick question related to uploading Images to server, Let’s say we have A client-side app, a server and a cdn should the clinet upload the images to the cdn and then make a rest request to the server to store all its info in the database or should the client upload directly to the server then the server upload to the cdn then store in the database and get back to the client


10/25/2017, 7:26 PM
Wait for other replies, but I was thinking of something similar and I imagine that with a request sniffer someone could later spoof requests to the CDN directly if you let the users do that directly through the app. Really interested in what others think too 😊


10/25/2017, 8:27 PM
i think the client should upload to the server so that the client is independent of the CDN


10/25/2017, 9:06 PM
I know with services like s3 there’s solutions like presigned upload urls ( This way your client talks to your server and your server gives it a url to do the upload to. Your server gets to control exactly where the uploaded file ends up(filename etc). This keeps the high bandwidth uploads off your server while still keeping things relatively decoupled. Ie in the future you could switch to a different storage backend that supports similar mechanisms or even return the client a url that points to an upload endpoint on your server (could be useful for testing locally etc).