What is the best, up to date method for uploading file(s) (image, video; 1 or even 1+ files per upload) to server via
http.post() even the best option?
I’m using Ionic 5, Cordova 9, and Angular. I can’t find a reliable up to date tutorial, the docs are absolutely horrid (maybe I’m wrong), and nothing I’ve tried has been able to work for me.
If you need information for what I’ve tried, environment info, more details, I have an additional forum post that was “too long” here: Forum Post
Thanks for any help.
It’s rather hard to say much about this because there isn’t a whole lot generic to say. Yes,
post works for uploading files, and yes, I would say it’s the best option at the moment. The exact format depends on what the server is wanting, but this Ben Nadel post looks like a useful starting point for you.
Thank you very much for your guidance It is greatly appreciated. I read through the post you linked and it seems like there is a considerable amount of useful information within it. I think my main problem is I get in the habit of oogling “ionic [problem]” or “ionic cordova [problem]” where I should really search “angular [problem]”. I’m still learning when and why to do which. In this specific instance he’s using the html5 file input, which I didn’t know worked for mobile applications. At the moment (just now got this to work), I’m using the ionic-cordova camera plugins in order to select images/videos from the photo library, and then managed to get the ionic-cordova filetransfer plugin to send them to the server for processing. I had most of my issues/confusiong trying to use the ionic-cordova file plugin combo to display the image/video in the app as soon as they uploaded it. Really all I need to do in PHP is
move_uploaded_file() to a read only directory with an encrypted path and I think it will be nice and safe for displaying on the app. Overall I may have been asking the wrong questions.