I’m working on an offline forms app that requires file upload, and I’m looking at using the Ionic Native “File Transfer” plugin for this. Reading the GitHub page for the underlying Cordova plugin for file transfer, I see that it’s been deprecated in favor of XMLHttpRequest.
Will this affect the Ionic Native functionality at all? How will future development on the Native plugin work? Does anybody know of a file transfer plugin that doesn’t rely on this Cordova plugin, so that I don’t have to go back and change my code later?
In theory we can for these forms, but we’re also hoping to add photo upload eventually and would like a simple, native way to select and upload files. I guess I’m confused why Ionic Native in v4 would have a File Transfer plugin if XMLHttpRequest is the way to go? I assume there must be some benefits to the plugin.
So, again, you can upload photos, or literally any type of file in existence, with XMLHttpRequest, that is why they deprecated it, as you already initially posted. So…it doesn’t matter if you are planning to upload files…use an http request. Just like you are for the forms. That’s the whole point of why they deprecated it… Ionic should imo also mark their ionic native wrapper as deprecated, but ionic native is just a set of wrappers to cordova, that’s why they still have it.
Selecting the image has nothing to do with the file transfer plugin, you’d want to use the image picker plugin or camera plugin. Then process the chosen files and upload with http.post. Granted you do have to do a little bit of work to grab the actual image file after the user selects it (or takes a picture with their camera), but it’s still pretty easy. In fact I wrote a tutorial about it back in March: roblouie | Learn Ionic Cordova File and Image Uploading By Building an Instagram Style App.