LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fail to upload image by POSTMultipart.vi

Solved!
Go to solution

I need upload one image into the cloud server. This API is working fine with tools POSTMAN, refer to the below screenshot, totally 3 kinds of data, ID: string, Key: string and images: file with form-data. The respond from body is correct, mean the API is working fine.

 

Postman-H.png

 

Now I try to move to LabVIEW with POSTMultipart.vi, but it always reports error 56 as the below:

 

LabVIEWHTTPClient.lvlib:POSTMultipart.vi:1540004<APPEND>

<b>Complete call chain:</b>
LabVIEWHTTPClient.lvlib:POSTMultipart.vi:1540004

This is my setting as the below screenshot, is there any mistake? Just follow the example and help document. 

POSTMultipart-BD.png

 

But when I delete the image path, just post the ID and Key, no error report from LabVIEW,  just an 400 error from the server. This is also correct since incomplete data. 

 

So I assume here is something is wrong about the image setting/configure. 

 

POSTMultipart-BD-2.png

Colin Zhang
------------------
LV7.1/8.2/8.2.1/8.5/8.6/9.0/2010/2011/2013/2015/2016/2020; test system development; FPGA; PCB layout; circuit design...
Please Mark the solution as accepted if your problem is solved and donate kudoes


Home--colinzhang.net: My Blog

iTestGroup: One-step test solution provider!
ONTAP.LTD : PCBA test solution provider!
0 Kudos
Message 1 of 5
(1,150 Views)

@colinzhang wrote:

But when I delete the image path, just post the ID and Key, no error report from LabVIEW,  just an 400 error from the server. This is also correct since incomplete data. 

 

So I assume here is something is wrong about the image setting/configure. 


An expected error when removing something does hardly validate what's left over.

 

You might be right, but it's a dangerous assumption. You wouldn't be the first to waste days (weeks, months) focusing on something that isn't the problem at all.

 

Can you read an image?

Are jpg images supported?

Did you get other multipost messages to work?

Images isn't capitalized, SecretKey is?

Why does it say Images, when it's only 1 image?

Are you sure the API allows posting images like that?

0 Kudos
Message 2 of 5
(1,101 Views)

wiebe@CARYA  已写:

@colinzhang wrote:

But when I delete the image path, just post the ID and Key, no error report from LabVIEW,  just an 400 error from the server. This is also correct since incomplete data. 

 

So I assume here is something is wrong about the image setting/configure. 


An expected error when removing something does hardly validate what's left over.

 

You might be right, but it's a dangerous assumption. You wouldn't be the first to waste days (weeks, months) focusing on something that isn't the problem at all.

 

Can you read an image?

Are jpg images supported?

Did you get other multipost messages to work?

Images isn't capitalized, SecretKey is?

Why does it say Images, when it's only 1 image?

Are you sure the API allows posting images like that?


Hi Wiebe,

Thanks for your reply.

 

I think the JPG images are supported, and API is also allowed, because the same image file is working fine with the postman, refer to the first screenshot which show the setting on the postman. The "images" are defined by the API provider, I can only follow the same. 

 

I understand that removing something is not a perfect way, but just better than nothing. Once removing the path of images, at least some error generated from the server, that means at least the rest data has already passed to the server successfully, as you mentioned "this is an expected error". Just better than an unexpected error.

Colin Zhang
------------------
LV7.1/8.2/8.2.1/8.5/8.6/9.0/2010/2011/2013/2015/2016/2020; test system development; FPGA; PCB layout; circuit design...
Please Mark the solution as accepted if your problem is solved and donate kudoes


Home--colinzhang.net: My Blog

iTestGroup: One-step test solution provider!
ONTAP.LTD : PCBA test solution provider!
0 Kudos
Message 3 of 5
(1,097 Views)

I'm mostly rubber ducking here 😊.

 

I suppose you can use wireshark to monitor the exact data?

0 Kudos
Message 4 of 5
(1,094 Views)
Solution
Accepted by topic author colinzhang

🙂 Yeah, this issue was fixed just now---> around 5 minutes ago. 

 

The real reason is really timeout, once I change the default timeout to 100 sec. It is working fine.

 

En.. not really resolved, so long implementation time seems not correct.

 

Share my path: I use the postman and APIpost to test this API, only postman is working fine. APIPOST also failed to timeout, after change the default timeout to 200 sec, the real cycle time is around 20 sec, and VI default timeout is also only 10 sec.

 

Sometimes we should believe the timeout error code, such as this one 🙂 

 

Yep, still not fixed perfectly. Why are VI and APIPOST both so long?  

Colin Zhang
------------------
LV7.1/8.2/8.2.1/8.5/8.6/9.0/2010/2011/2013/2015/2016/2020; test system development; FPGA; PCB layout; circuit design...
Please Mark the solution as accepted if your problem is solved and donate kudoes


Home--colinzhang.net: My Blog

iTestGroup: One-step test solution provider!
ONTAP.LTD : PCBA test solution provider!
Message 5 of 5
(1,090 Views)