Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function videoPicker() {
- const file = await ImagePicker.launchImageLibraryAsync({
- mediaTypes: ImagePicker.MediaTypeOptions.Video,
- });
- setVideo(file);
- }
- async function uploadVideo(){
- var movVideo = {
- uri: video.uri,
- type: 'video/mp4',
- name: (title)+'.mp4'
- }
- var body = new FormData();
- body.append('file', movVideo);
- body.append('title', title);
- fetch('http://192.168.0.106:3333/upload', {
- method: "POST",
- headers: {
- 'Accept': 'application/json',
- 'Content-Type': 'multipart/form-data',
- 'authorization': 'c99afe28'
- },
- body: body,
- }).then((response) => {
- setPicked(false)
- response.json()
- })
- .then((responseJson) => {
- Alert.alert("UPLOAD COMPLETO");
- console.log(responseJson);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement