0

I am concentrating on building a new project which will search for an image and display the result. For that I'm using a .NET web service using SOAP client..

But in calling the function UploadFile(),the first parameter is the byte array format of the image,but every time it shows null..

my code is as follows..

  $client = new SoapClient("http://www.myserviceurl.com?wsdl");
  $byte_array = file_get_contents('mypic.jpg');
  $image = base64_encode($byte_array);
  $result=$client->Upload($image, "mypic.jpg");
  print_r($result);

but $result prints like this..

stdClass Object ( [UploadFileResult] => Buffer cannot be null. Parameter name: buffer )

Please help me by saying that how to get the bytearray of an image uploaded.. Thanks in advance..

0

1 Answer 1

1

Check this

<?php
$filename = "mypic.jpg";//Image path
$file = fopen($filename, "rb");
$contents = fread($file, filesize($filename));
fclose($file);
?>

Happy Coding!!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.