NativeScript / sample-ImageUpload

An integration of nativescript-image-picker and nativescript-background-http
Apache License 2.0
22 stars 19 forks source link

Upload not working on Angular app #15

Closed emeka-osuagwu closed 7 years ago

emeka-osuagwu commented 7 years ago

I tried to upload to my back end service and it;s kept falling each time i tried it.

this is what i did ` sendImages(uri, fileUri) {

    this.imageName = this.extractImageName(fileUri);

    var request = {
        url: "http://httpbin.org/post",
        method: "POST",
        headers: {
            "Content-Type": "application/octet-stream",
            "ProfilePic": this.imageName
        },
        description: "{ 'uploading': " + this.imageName + " }"
    };

    var task = session.uploadFile(fileUri, request);

    task.on("progress", logEvent);
    task.on("error", logEvent);
    task.on("complete", logEvent);

    function logEvent(e) {
        console.log("currentBytes: " + e.currentBytes);
        console.log("totalBytes: " + e.totalBytes);
        console.log("eventName: " + e.eventName);
    }

    return task;
}`
tsonevn commented 7 years ago

Hi @emeka-osuagwu, Could you verify, whether you will have the same problem with the following sample app . If you still have the same problem, please provide some info about your environment(CLI modules nativescript-imagepicker versions). It would also help if you send us sample project, which could be debugged locally.