Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Unable to upload image (React native, Laravel)

$
0
0

I have been trying this for a while but no success

Back-end

public function createInspection(Request $request) {   $path = Storage::disk('public')->putFile('bin_images', new File($request->file('image')));   return $path;    }

Client

data.append("image", {  uri: this.state.images[0].path,  type: this.state.images[0].mime,  size: this.state.images[0].size,  name: filename});this.props.sendInspection(data)

Service (shortend)

const res = await axios.post(url, data, {    headers: {      Authorization: `Bearer ${token}`,      Accept: "application/json","Content-Type": "multipart/form-data"    }  });

im not sure if it's something to do with path not being recongnized (ios image path) e.g. path :/private/var/mobile/Containers/Data/Application/B6FEB0FD-F9C8-4088-B15F-99D27A818C76/tmp/react-native-image-crop-picker/7BD81594-30E0-4E00-919C-4F353BBDE46F.jpg

I get this error

message: "The file "" does not exist", exception: "Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException", file: "/Users/ysr/tza-project/vendor/symfony/http-foundation/File/File.php", line: 37, file: "/Users/ysr/tza-project/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php", line: 116


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>