I have a java application that will send a CSV file to a Drupal 7 site through using POST method.

how i receive file on drupal side by using custom module

I need to parse the file to add data into a custom table.

  • 1
    you can try with services module – Adi Oct 7 '15 at 11:40
  • I second the services module, here is a PHP gist on uploading file: gist.github.com/MuhammadReda/e2fee99a2469bc324f38 - just watch out to get the X-CSRF-TOKEN set right. Depending how secure it needs to be session based authentication is fairly straightforward. Then you could use hook_file_insert to add your custom meta data. – bloke_zero Oct 7 '15 at 13:10

I will try again:

you can var_dump($_POST); to get all posted variables on the site and know the array index in which your application POST's

  • According to your answer I made a custom web service to do this :) – Promo Oct 13 '15 at 8:43
  • @Promo You've made a REST cliënt in Java to be precise. – Thomas Oct 13 '15 at 8:51
  • No I didn't work on java side, only Drupal. So a made a simple page that is called by a POST with http authentication. Then I parse the file and add data to the database :) – Promo Oct 14 '15 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.