[development] WebAPI uploads

CM Lubinski cmc333333 at gmail.com
Wed Jan 5 01:19:22 UTC 2011

Hash: SHA1

If you have a RESTful interface, I'd suggest POSTing to the appropriate
end point with the body of the message being the contents of the file
you wish to send.

Otherwise, you can imitate a form POST from within your client. AK has a
quick example [1] of this using PHP and cUrl.

Hope this helps,
CM Lubinski

[1] http://www.akchauhan.com/how-upload-file-using-curl/

On 01/04/2011 02:46 PM, Blake Senftner wrote:
> Hi Drupal Devs,
> My previous experience with writing a WebAPI was through the Services 2.x module, and the usage was for internal web site to work-horse server communications. The method I used back then for file uploads was to simply place the file to be uploaded to the work-horse server inside a directory under web site's docroot and then pass the file's URL as a parameter to the WebAPI function call that requires the file. At the work-horse server, the heavy lifting is performed by a BASH driven processing pipeline, so the file URL was passed to CURL to somewhere in that BASH pipeline to get the needed file.
> However, I am starting work on a WebAPI that will be using Services 3.0 and the WebAPI will be publicly accessible. What is the "best practice" for file uploads to a WebAPI? The files being passed through the WebAPI vary from 30K to potentially 100 megs (smaller files are images, medium files are complex data, larger files are video). 
> Any good web resources for this and similar WebAPI architecture information are welcome. 
> Sincerely,
> -Blake
Version: GnuPG v1.4.10 (GNU/Linux)


More information about the development mailing list