2

I am sure its possible in Drupal also.

Here is the reference for Java code

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

and

https://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

  • May I ask why you want without base64 encoding? – Kartagis Dec 15 '15 at 7:15
  • Sometime encoding of base64 is not working for iOS and Android development. So I want to post file directly. Like we are doing in HTML form using enctype="multipart/form-data". – Firoz Sabaliya Dec 15 '15 at 11:13
  • Regardless, I was getting that error because the file was too big and my colleague's instance of PHP/CGI couldn't take it (weird huh?) – Kartagis Dec 15 '15 at 14:42
  • DId you get this to work? – Shane Birley Jan 13 '17 at 4:27
  • No, it was not working – Firoz Sabaliya Jan 16 '17 at 14:15

Browse other questions tagged or ask your own question.