Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- handleChoosePhoto = () => {
- var options = {
- title: 'Select Image',
- storageOptions: {
- skipBackup: true,
- path: 'images',
- },
- };
- ImagePicker.showImagePicker(options, response => {
- if (response.uri) {
- console.log(response)
- this.setState({ photo: response })
- }
- //alert(this.state.photo.fileName)
- //this.onSubmitPhoto();
- })
- }
- onSubmitPhoto = (e) => {
- var url = 'https://absensiapiendpoint.azurewebsites.net/api/BlobStorage/InsertFile';
- const Header = {
- // 'Content-Type': 'multipart/form-data',
- // 'accept' : 'text/plain'
- }
- var formData = new FormData();
- formData.append("stream", this.state.photo, this.state.photo.fileName)
- axios.post(url, formData ,Header)
- .then(data => {
- this.setState({
- urlphoto : data.data
- })
- alert(this.state.urlphoto)
- console.log("ulrnya : " + this.state.urlphoto)
- }).catch(err => {
- //alert(err)
- console.log(err)
- }
- )
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement