Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support file:// upload using cordova file-transfer #144

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

byrne-yan
Copy link

Usage:

var uri = 'file:///data/data/com.idja9xh81xomlsb1nrtg92/cache/snw_photo_0053.jpg'
uploader.send(uri,function(err,downlaodUrl){
    if(err){
        console.log(err);
    }else
    {
        console.log(downlaodUrl);
    }
});

@filipenevola
Copy link

hi @byrne-yan , it looks fine in Android but not in iOS.

Are you aware of this? I got "not a file" error.

@@ -86,20 +135,34 @@ Slingshot.Upload = function (directive, metaData) {
*/

send: function (file, callback) {
if (! (file instanceof window.File) && ! (file instanceof window.Blob))
if (! (file instanceof window.File) && ! (file instanceof window.Blob) && !( typeof file==='string' && /^file:\/\/.*$/i.test(file)) )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This checks only for Android and BB based file path. https://github.com/apache/cordova-plugin-file#file-system-layouts

@cosmin-novac
Copy link

Is this supported now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants