I created a rest server using the codeigniter rest server library created by PhilSturgeon :
github.com/philsturgeon/codeigniter-restserver
Now, I am using Codeignitor rest client :
github.com/philsturgeon/codeigniter-restclient
to get
/post
data from/to the rest server and am successfully able to get/post normal data.
What is the best way to post image files to the rest server from the rest client ?
Also, how can someone can access the API and perform all get/post operation from C# .NET assuming the rest server uses digest authentication ? [any library available ?]
As Amit has suggested, you can send the contents of a file
file_get_contents('foo.jpg')
or you could do something more true to the spec and do something like:Then for the body you just set the contents of the image (or whatever type of file you're firing off).
You can then pick that up in your PHP with:
That will have the contents of your image, so you can save it wherever.
These solutions did not work for me. However, I posted my solution here:
Codeigniter and RestServer. How to upload images?
I was actually able to use CodeIgniters native File Upload class to solve this same issue: https://stackoverflow.com/a/11163068/1188523
After searched for more than 1 days, finally this is what worked for me
Simple Rest Post service to upload & store a file from any Rest client