Giter Site home page Giter Site logo

react-native-fileupload's People

Contributors

philippkrone avatar venepe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-fileupload's Issues

upload: Error happened: favoriteFilled.png: open failed: ENOENT (No such file or directory) null

@PhilippKrone - Where to keep the file which is to be uploaded?
In Below documentation, what does absolute path means? Where to keep the file? '/' refers to which root folder - apps root folder( where index.android.js resides) OR to mobiles handset file system?
files: [
{
name: 'one', // optional, if none then filename is used instead
filename: 'one.w4a', // require, file name
filepath: '/xxx/one.w4a', // require, file absoluete path
filetype: 'audio/x-m4a', // options, if none, will get mimetype from filepath extension
},
]

In my code, I kept png file in apps root folder, and used following code but it gives above error.
filename: 'favoriteFilled.png',
filepath: 'favoriteFilled.png',

I have tried giving filepath as:
'filepath: '/favoriteFilled.png',
'filepath: './favoriteFilled.png'
But, still same error I get.

Android upload not working error: 'typeint64' null

iOS upload is working perfectly, but with Android I get this error:

TypeError: expected dynamic type 'string', but had 'typeint64' null

Here is my code:

code

And here is a log of the object I am passing it and the the error:

error

How do I fix this?

Support for react-native > 0.60

#Feature Request

I would love to see this updated and supported for react 0.60 >

#Why it is needed

I have an older app who uses this library, and always thought it was great, but can't use it anymore when upgrading react.

It is working?

Hi,

Is this repository working with current versions of react-native/android/ios?

Thanks

not working for s3

Using RN 17. Below is the code.

var obj = {
uploadUrl: 'http://makeuroffer.s3.amazonaws.com',
method: 'POST', // default 'POST',support 'POST' and 'PUT'
headers: {
//'contentType': 'image/jpeg',
'Accept': 'application/json',
},
fields: {
"acl": "public-read" ,
"Content-Type": "image/" ,
"key": 'biz/' + 'third.jpg' ,
"x-amz-meta-tag": '' ,
"x-amz-meta-uuid": "14365123651274",
"bucket": 'makeuroffer' ,
"x-amz-algorithm": "AWS4-HMAC-SHA256" ,
"x-amz-credential": data.key + "/" + moment().format('YYYYMMDD') + "/" + 'us-west-2' + "/" + 's3' +"/aws4_request" ,
"x-amz-date": data['x-amz-date'] , //'20160112T105326Z'
"policy": data.policy,
"x-amz-signature": data['x-amz-signature']
},
files: [
{
//name: 'filename', // optional, if none then filename is used instead
filename: 'more.jpg', // require, file name
filepath: pic.uri, // require, file absoluete path
//filetype: 'audio/x-m4a', // options, if none, will get mimetype from filepath extension
},
]
};

FileUpload.upload(obj, function(err, result) {
  debugger;
  console.log('upload:', err, result);
});

Error uploading in Android

Anybody know why could be this error, when trying to upload on Android?

undefined is not a function (evaluating '_reactNativeFileupload2.default.upload')

Thanks!

[Android] Error:Configuration with name 'default' not found.

When I added "compile project(':react-native-fileupload')" to gradle.build
and tried to gradle sync, I've got this error below.

"Gradle 'android' project refresh failed
Error:Configuration with name 'default' not found."

If I delete [compile project(':react-native-fileupload')] line, build passes.

When I tried to clean the build, I got more specific message like below.
"Error:A problem occurred configuring project ':app'.

Cannot evaluate module react-native-fileupload : Configuration with name 'default' not found."

I'm using react-native 0.14.0-rc

compile failed

:react-native-fileupload:mergeReleaseResources
:react-native-fileupload:processReleaseManifest
:react-native-fileupload:processReleaseResources
:react-native-fileupload:generateReleaseSources
:react-native-fileupload:processReleaseJavaRes UP-TO-DATE
:react-native-fileupload:compileReleaseJavaWithJavac
.../node_modules/react-native-fileupload/android/src/main/java/com/yoloci/fileupload/FileUploadModule.java:23: error: package com.facebook.internal does not exist
import com.facebook.internal.BundleJSONConverter;

react-native 0.37.0

RCTBridgeModule.h FILE NOT FOUND

  1. In XCode, in the project navigator, right click your project ➜ Add Files to [your project's name]
  2. Go to node_modules ➜ react-native-fileupload and add FileUpload.m
  3. Run your project (Cmd+R)

Followed this step and stuck at this error. i am checking this module on ios.

Https android uploads fails

  • the api call to upload file in http works, but when I try the https url it gives me Internet Server Error, any solutions?

[Android] Problem sending multiple images to my server. The server only receive the last image. It works perfectly on iOS

I send three images to my server with this code:


var obj = {
            uploadUrl:  Globals.BASE_URL + Globals.API_PATH + q,
            method: 'POST', // default 'POST',support 'POST' and 'PUT' 
            headers: {
                'Accept': 'application/json',
                'Authorization': 'application/galickho',
            },
            fields: {
                email:"[email protected]",
            },
            files: this.state.images
        };
console.log(obj.files);   // This is correct: 3
FileUpload.upload(obj, function(err, result) {
                console.log('upload:', err, result);
                if(err != null){
                    reject(ErrorManager.getError("http_error"));
                }else{
                    resolve(result);
                }
            })

And my server returns the contents of the $_FILES variable. If I sent images from an iOS device, my server returns three images. But if I have sent the images from an Android device, only it returns the last image...

Simple PHP Code:
echo json_encode($_FILES);

Device: ACER A3-A20FHD
Android OS: 4.4.2
RN ver. 0.31
RN Cli ver. 0.2.0
Plugin ver. 1.2.0

[Android] Error happened: Precondition Failed

Hi!

I'm trying to upload an image on android with this code:

var obj = {
    uploadUrl: config.API_URL + 'images',
    method: 'POST',
    headers: {
        ...config.HEADERS,
        'Authorization': 'Bearer ' + this.userToken
    },
    fields: {
        'one': 'two'
    },
    files: [
        {
            name: 'file',
            filename: 'avatar.jpg',
            filepath: this.avatarSource.uri
        }
    ]
};
FileUpload.upload(obj, (function (err, result) {
    //err === 'Error happened: Precondition Failed'
}).bind(this));

And I'm receiving this error. Do you have any ideas why does it happen?

Thanks!

Android : 'name' parameter is ignored, always sends name as 'image'

The Android implementation has a hardcoded value for 'name', which is contrary to the documentation and to the iOS implementation. The 'name' parameter passed is ignored.

Although #26 addresses this, it does not follow the behaviour of the documentation, namely:
// optional, if none thenfilenameis used instead

run-android failed

hi,i use commad "react-native run-android",then failed...
react-native : 0.16.0

log:
:react-native-fileupload:compileReleaseJavaWithJavacF:\apowo\PTuApp\client\truck\P2_16\node_modules\react-native-fileupload\android\src\main\java\com\yoloci\fileupload\FileUploadModule.java:23: ▒▒▒▒: ▒▒▒▒▒com.facebook.internal▒▒▒▒▒▒
import com.facebook.internal.BundleJSONConverter;

I do not know Why...

how to upload image aws

i have a doubt that how to upload an image to amazons3 with this, For upload an image can i use this repo, if possible how to use it

Can't get image data

I can't upload image binary in android.

here is my android file path

constructor(props) {
super(props);
this.state = {
avatarSource: null,
videoSource: null
};
var obj = {
uploadUrl: 'http://192.168.50.161:8080/soledede/image',
method: 'POST', // default 'POST',support 'POST' and 'PUT'
headers: {
'Accept': 'application/json',
//'Accept': 'multipart/form-data',
//'Content-type': 'multipart/form-data'
//'Content-Disposition': 'form-data; name="file"',
},
fields: {
'hello': 'world',
},
files: [
{
name: 'image', // optional, if none then filename is used instead
filename: '1007044', // require, file name

filepath: 'content://media/external/images/media/1007044', // require,
filetype: 'image/png,image/gif,image/jpeg',
},
]
};
FileUpload.upload(obj, function (err, result) {
console.log('upload:', err, result);
});
}

there is my debug in chrome
image

what's like the android file path ,can show me a example

How can I deal with it in android

Thanks

soledede

Absolute Path and local server

I am using xcode emulator to test, I installed camer-roll-picker to pick and get image path and name . In Xcode for one of camera roll image , details are as follows:
filename: 'IMG_0005.JPG',
filepath: 'assets-library://asset/asset.JPG?id=ED7AC36B-A150-4C38-BB8C-B6D696F4F2ED&ext=JPG'

I tried above, and I tried localhost e.g. http://localhost:8888/photos , I do not see a pic, Its my 3rd day but i did not have any idea what absolute path stands for in this context. I also tried putting images under app files folder wherever possibly I can . none worked.

Build fails on React Native 0.15 for Android

Hey there,

i would love to use this but i get following error:

node_modules/react-native-fileupload/android/src/main/java/com/yoloci/fileupload/FileUploadModule.java:23: error: package com.facebook.internal does not exist import com.facebook.internal.BundleJSONConverter;

Can't upload with android

I have a problem
image

err = "Error happened: TypeError: expected dynamic type string', but had typeint64'"
This my debug env,who can help me

I using react-native 0.18.0

Upload video from asset-library

Is it possible to upload video ?
I'm trying to upload on S3, everything is working but when I download my file again I can't open it. The file seems broken.
Do you have any idea ?

Error: upload without files will crash

var obj = {
uploadUrl: options.uploadUrl,
method: 'POST',
headers: {},
fields: {},
files: []
};
NativeModules.FileUpload.upload(obj, function(err, result) {
if (result && result.data === 'ok') {
handleRight()
} else {
handleError();
}
});

in FileUploadModule.java/upload
fileInputStream.close();
this line will crash as i pass an empty files array, I think maybe here should have a judge if files array is empty

Add a maintainer

Thanks for this plugin! It looks like there are a few issues and PRs that could use attention though. Is it possible to add a maintainer in order to get the PRs sorted out? Or perhaps to think about merging this + PRs into one of the other fs modules? I'd be glad to volunteer.

Ref: #9 #15 #20 and timsuchanek#1

App crashes when trying a POST

I am trying to upload a image from FileSystem, which is jpg Format. But i get the RedBox Message "could not invoke FileUpload.upload"

screen shot 2015-12-14 at 19 11 24

This is my code:

var FileUpload = require('NativeModules').FileUpload;
var UIImagePickerManager = require('NativeModules').UIImagePickerManager;
    UIImagePickerManager.showImagePicker(options, (didCancel, response) => {
        console.log('Response = ', response);
        if (didCancel) {
            console.log('User cancelled image picker');
        }
        else {
            fileName = response.uri.substring(response.uri.lastIndexOf("/") + 1);
            fsPath = response.uri;
            var binaryResponse = response.data;
            const obj = {
                uploadUrl: API_URL + 'user/avatar',
                method: 'POST',
                headers: {
                    'Authorization': AuthStore.getUserTokenWithBearer()
                },
                fields: {
                    'hello': 'world',
                },
                files: [{
                    filename: 'image',            // this is what your server is looking for
                    filepath: response.uri,     // uri from response (local path of image on device)
                    filetype: 'image/jpeg'
                }]
            };
            FileUpload.upload(obj, (err, result) => {
                console.log('upload:', err, result);
            });
        }
    });

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.