Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
github.com/booxood/react-native-file-upload
A file upload plugin for react-native written by Objective-C.
npm install react-native-file-upload --save
your project
➜ Add Files to [your project's name]
node_modules
➜ react-native-file-upload
and add FileUpload.m
Cmd+R
)All you need is to export module var FileUpload = require('NativeModules').FileUpload;
and direct invoke FileUpload.upload
.
'use strict';
var React = require('react-native');
var FileUpload = require('NativeModules').FileUpload;
var {
AppRegistry,
StyleSheet,
Text,
View,
} = React;
var FileUploadDemo = React.createClass({
componentDidMount: function() {
var obj = {
uploadUrl: 'http://127.0.0.1:3000',
method: 'POST', // default 'POST',support 'POST' and 'PUT'
headers: {
'Accept': 'application/json',
},
fields: {
'hello': 'world',
},
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
},
]
};
FileUpload.upload(obj, function(err, result) {
console.log('upload:', err, result);
})
},
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
});
AppRegistry.registerComponent('FileUploadDemo', () => FileUploadDemo);
MIT
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.