Quantcast
Channel: Question and Answer » web-services
Viewing all articles
Browse latest Browse all 136

Post/Upload file using Drupal Services Module without base64 (Using REST multipart/form-data )

$
0
0

I am sure its possible in Drupal also.

Here is the reference for Java code

http://stackoverflow.com/questions/5723429/use-rest-client-to-call-multipart-form-data-rest-web-service

and

http://stackoverflow.com/questions/8989937/form-post-through-rest-client-multipart-upload

But how can I implement for Drupal?

I want to upload/post a file to Drupal site using services module(without base64 encoding).

File uploading with base64 encode using Services module is working fine. I have followed this tutorial

But I need to Post file without base64 encode.

I have tried following steps.But that’s not working (I am using Chrome extension Postman)

Step 1:
I have added Header like:

Cookie: XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Content-Type: multipart/form-data
X-CSRF-token: O7XJHc4DZOVTLSpgRQgF-XD5VD7QFkBpo7QIW8pfN7g

enter image description here

Step 2:
Body parameters

file[file]: Choose files
file[filename]: myfilename.jpg
file[filepath]: public://my1.jpg

enter image description here

After following above steps I am getting error “Missing data the file upload can not be completed”

I am using Drupal 7 and Services 3


Viewing all articles
Browse latest Browse all 136

Trending Articles