C
C#5mo ago
SwaggerLife

✅ Suggestion on file upload?

When uploading file to azure storage. Should I upload the files through the server (api)? or is there another way. The thing that scares me is that if multiple people upload at the same time than we will have a memory issue. The clients in this case are mobile apps? Any insights would be appreciated.
30 Replies
ffmpeg -i me -f null -
why does an upload stream worries you about memory?
SwaggerLife
SwaggerLife5mo ago
@dont If the upload process is done through the server. The mobile apps will send the files to the server (API), and then the server will upload the files to Azure Storage. If there are multiple people uploading files at the same time, there will of course be a load on the server.
leowest
leowest5mo ago
it will have a load but memory issue would depend on how the file is being sent, if you use a stream then it will send chunks at a time and not the whole file thus I dont see how that would cause a memory issue
ffmpeg -i me -f null -
what's your spec, like 5, 10, 15 uploads contemporaneously? 50? 100?
SwaggerLife
SwaggerLife5mo ago
Still small chunks can quickly lead to large amount. I don't really know as of now. It depends on how many people download the apps.
leowest
leowest5mo ago
no, because they dont remain in memory, they are sent as chunks to lessen the memory to disk process but if u have a 1m users all sending files a the same time u have to account for that 1m*the chunk size etc because that would be part of your load
SwaggerLife
SwaggerLife5mo ago
I guess, that does make sense. The issue is that I need to validate the content before. I could use Shared Access Signatures. To allow the clients to upload the files directly to a specific blob.
leowest
leowest5mo ago
validate in what way? like u want to ensure it is a type of mime or
SwaggerLife
SwaggerLife5mo ago
See if there is any sexual contents etc.
ffmpeg -i me -f null -
i guess so, but you still have to build an initial system, if you say i go big and support 100_000 uploads from the beginning it's going to be pretty different from 100 uploads
leowest
leowest5mo ago
so we are talking about video/images only?
SwaggerLife
SwaggerLife5mo ago
Exactly
leowest
leowest5mo ago
and currently how do u check that manually watching?
SwaggerLife
SwaggerLife5mo ago
I guess, maybe I'm thinking to far ahead. I do a check through the client.
leowest
leowest5mo ago
that doesn't say much
SwaggerLife
SwaggerLife5mo ago
On the server side, I was thinking of using Azure content moderator.
leowest
leowest5mo ago
but that would be after u passed the file down to azure no?
SwaggerLife
SwaggerLife5mo ago
I use an AI library that does the validation.
fasadin
fasadin5mo ago
you can give token to decidated space to user. Let him upload to cloud then you can have some job that moves from there files to correct places short lived token of course
SwaggerLife
SwaggerLife5mo ago
If I use Shared Access Signatures, than yes. If I go with the manual process. I can validate the content before storing it.
leowest
leowest5mo ago
but you said you're going to use azure's content safety so you're double validating ?
SwaggerLife
SwaggerLife5mo ago
Yes, I'm double validating. I don't really trust the validation on the client side. There are always people that will try and bypass.
leowest
leowest5mo ago
well then why not just letting azure handle it or u mean u dont trust azure's ai content safety
SwaggerLife
SwaggerLife5mo ago
You mean like, create a container that holds the not yet validated content. Than directly after the user uploads the content through Shared Access Signatures. I call the api, and tell it to validate and than move it to the correct container?
leowest
leowest5mo ago
any upload goes to a moderated container by default and are moved to the correct place once validated
SwaggerLife
SwaggerLife5mo ago
I do trust the azure's ai. I was just hesitant on how to upload the files to prevent issues.
leowest
leowest5mo ago
I mean given everything u said I think that would be the most conventional way to avoid issues but I could be wrong any new upload goes to a moderated container that verifies and moves the files to a safe container
SwaggerLife
SwaggerLife5mo ago
Yeah this is probably the best way
any upload goes to a moderated container by default
and are moved to the correct place once validated
any upload goes to a moderated container by default
and are moved to the correct place once validated
Exactly. Thanks for your insight, guys. I really appreciate it.
fasadin
fasadin5mo ago
mobile app it's calling cloud host (azure) to do that he needs token. You can create seperate container and then give it access to correct path (for each user so other users won't be able to see / write other files) Then you might have some background job that moves is to correct place (if you want to have some confirmation done, that can be also there, for moderation purposes)
SwaggerLife
SwaggerLife5mo ago
Sounds like a plan.