terikon / cordova-plugin-photo-library

Maintainer needed. Please contact if you're using this library in your project
MIT License
149 stars 295 forks source link

how can i upload photo? #45

Closed mayajuni closed 7 years ago

mayajuni commented 7 years ago

hi. thank you for your plugin.

i hava problum.

i used this and transfer plugins. i want to upload photo.

I tried it several times with the photoURL.

how can i used photoURL and upload file??

Kanaho commented 7 years ago

I'm facing the same problem. I can't upload my pics with fileTransfer. And the getter of base64 keep returning me undefined.

Help will be very apprecied. And thanks for the plugins.

Kanaho commented 7 years ago

Well resolved for me, was just a bug on my server side who limited the size of files.

`var options = { fileKey: "qqfile", fileName: filename, mimeType: "image/jpeg" };

    const fileTransfer = new Transfer();

    return fileTransfer.upload(filename, url, options)`

That should make the job mayajuni

mayajuni commented 7 years ago

@Kanaho thank you for your answer.

i tried your code. but i can not it.

i have error.

FileTransferError
body: null
code: 1
exception: null
http_status: null
source: "D5A11FF0-80BE-4236-BA19-62CA7D51D0EC.JPG"

what is filename? libraryItem.fileName?

thanks.

mayajuni commented 7 years ago

this error is 'FileTransferError.FILE_NOT_FOUND_ERR'

i think, i need file path(dateURL or fileURL).

how can i get?

Kanaho commented 7 years ago

No, my "filename" is a variable who get libraryItem.photoURL. But you're right in the fact that the name is not really well choose, that's more the full path that you have to give to the FileTransfer, and he accept the cdvphotolibrary format so that work pretty fine.

mayajuni commented 7 years ago

@Kanaho Thank you for replay. I also tried it. but same error. do you test ios? what do you use file transfer plugin?

Kanaho commented 7 years ago

Finally tried on IOS and yeay, i've the same error than you. It only work on Android I think that's because this plugin don't return a .jpg in the fileUrl (photo or thumbnail) and file-transfer dont find a file without any type. That's not a valid path for File Tranfer.

But i see that you still have a .JPG in fact..

viskin commented 7 years ago

Duplicate of #51 - let's move the conversation there