文件从 REST 客户端上传到 REST 服务器
我使用 PhilSturgeon 创建的 codeigniter 休息服务器库创建了一个休息服务器:
github.com/philsturgeon/codeigniter-restserver< /a>
现在,我正在使用 Codeignitor 休息客户端:
github.com/philsturgeon/codeigniter-restclient
从/向其余服务器获取
/发布
数据,并且能够成功获取/发布正常数据。
从其余客户端将图像文件发布到其余服务器的最佳方法是什么?
另外,假设其余服务器使用摘要身份验证,如何才能访问 API 并从 C# .NET 执行所有 get/post 操作? [有可用的图书馆吗?]
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 ?]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
简单的休息邮政服务上传和下载存储来自任何 Rest 客户端的文件
Simple Rest Post service to upload & store a file from any Rest client
经过 1 天多的搜索,终于这对我有用
After searched for more than 1 days, finally this is what worked for me
正如 Amit 所建议的,您可以发送文件
file_get_contents('foo.jpg')
的内容,或者您可以做一些更符合规范的事情,例如:然后对于正文,您只需设置图像的内容(或您要触发的任何类型的文件)。
然后,您可以在 PHP 中使用以下命令来获取它:
这将包含图像的内容,因此您可以将其保存在任何地方。
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.
我实际上能够使用 CodeIgniters 本机文件上传类来解决同样的问题: https://stackoverflow.com/a/11163068/1188523
I was actually able to use CodeIgniters native File Upload class to solve this same issue: https://stackoverflow.com/a/11163068/1188523
这些解决方案对我不起作用。但是,我在这里发布了我的解决方案:
Codeigniter 和 RestServer。如何上传图片?
These solutions did not work for me. However, I posted my solution here:
Codeigniter and RestServer. How to upload images?