Uploading photos IOS Swift

1

I have an application where I need to upload some photos to a server, when I upload a single photo it works fine, now if it is two or more photos it takes an expressive time to finish the operation. I pass these photos turning them into base64. Anyone have any ideas on how I can make these uploads faster.

    
asked by anonymous 18.11.2015 / 23:01

1 answer

0

You do not need (and nor should ) convert the images to Base64 to send images to a remote server.

It should not , because Base64 is not a compression algorithm, it does the opposite, it increases (and quite) the weight of the payload, maybe that's why your upload takes so long. Making Base64 transfer when the two ends can interpret the same binary format in common, is a bad practice.

And does not need to because any server with any application running running that pays, can read the binary boundary field to convert it into binary image format (gif, jpg, png, wherever) on the server itself.

If you're uploading a lot of high-quality images, then it's already an OTHER story. You'll have to create your own upload strategy to avoid overloading networking and interface time until the upload completes. In that case, I would save everything local and upload it in the background bit by bit using a background task or a secondary operation with the app open.

    
25.11.2015 / 19:01