Upload image binary objective c - swift

I have one request where I want to upload image in binary as attached screenshot of postman.
Also the image request doesn't require key so sending a multipart / form data doesn't work here which I have already tried.
In android I am sending the same request as
httpPost.setEntity(new ByteArrayEntity(ImageData))
enter image description here

Related

Flutter - Upload file to Google Cloud Storage , PUT on signed URL

I am struggling to get file upload on google cloud storage working with flutter.
We are using a PUT signed URL generated via https://cloud.google.com/storage/docs/samples/storage-generate-upload-signed-url-v4#storage_generate_upload_signed_url_v4-nodejs
On the Flutter side, when we make PUT with a multipart form request it ends up with "No Content" and failed to upload the file. We are adding a file to the request. as a multipart form.
final httpImage = http.MultipartFile.fromBytes('file', bytes,
contentType: MediaType.parse("image/png"),
filename: fileName);
and certainly blocked now with the implementation. Already tried to get a binary array from the file and posting file along with the policy but that did not work either.

Dart: Catch NetworkImage loading error when no valid image url is provided

I let user submit image urls in my app which are used to load the images as Network Image afterwards.
Since I only check if the url is valid on submission but not if its a valid image it can happen that I run into "Exception: Could not instantiate image codec." (e.g. when the url is www.google.com).
How can I catch this exception? I tried using a try / catch statement but this does not work. Any ideas?
fetch/download the image from the url, then construct a image with the bytes
but
before doing it when you receive the download response from the url address, check the Content-type header is of any type of image for example image/jpeg after checking the header, download if its a valid image type, then as i said construct the image from bytes you received

Docker REST API : Create Image issue : Need help for parameter fromSrc:

Hi Guys need your help.
I am creating an Image via docker REST API.
The link mentioned for parameter fromSrc following is the description :
fromSrc: Source to import. The value may be a URL from which the image can be retrieved or - to read the image from the request body. This parameter may only be used when importing an image.
if anyone can suggest the meaning of to read the image from the request body part and how we can test this
to read the image from the request body
means that you have to put your image as Json into the body of your request.
The URL, in this case, will look like this '.../images/create?fromSrc=-'
To test this, you can use Restlet client or Postman, which are chrome extensions that let you build a request with a body.

Multipart upload binary content with OneDrive Rest APIs

As per the API documentation here I formed my request with postman as follows:
. This is working fine.
But when it comes to binary content(encoded in base64 format), it uploads the file but that is not previewed when I try to open the same on OneDrive.
File gets uploaded successfully but not previewable.
What am I missing here? Any suggestions?
OneDrive doesn't support Content-Transfer-Encoding when using the multi-part upload method. In this case, we're ignoring the header (that seems like a bug) and just storing the base64 encoded data in the file stream (without decoding it).
You'll have to upload the raw bytes as the second part of the request, without any content-transfer-encoding, to have this work.
Since it seems like you are just uploading a file and not trying to set any custom metadata while doing it, you're better off using one of the other upload methods, like PUT or createUploadSession
Drive does not store the image in the base64 format it stores it in binary. you can directly select the image using postman and can upload as binary with the multipart request
Here is the link for adding blob in the postman
How to upload images using postman to azure blob storage

How to intercept multipart/form data in fiddler and access a binary file which is a part of the request

I am trying to intercept requests send to a server from my mobile device. There is this post request which will upload payload to the server and the request has a file of type .pb, which i cant read in fiddler. Is there a way to get hold of the file ?
It's not clear what "i cant read in fiddler" means.
Use Fiddler's HexView request inspector to inspect the POST body. You can select the bytes of the file upload and choose Save bytes to save the file out to your desktop.