mod_http_upload - HTTP File Upload (XEP-0363) using Ruby on Rails

Siddhartha Narang picture Siddhartha Narang · Feb 23, 2016 · Viewed 8.8k times · Source

I want to transfer image between users in my chat application. I am using an ejabberd server for chat. As I found out, the module which could do this is mod_http_upload - HTTP File Upload (XEP-0363).

I am not able to figure out how to implement this. Anybody how could help me in figuring out how to do this will be very helpful.

Answer

Sunil Singh picture Sunil Singh · Feb 24, 2016

In order to use this module add configuration setting in ejabberd.yml file

listen:
    # add following lines in listen section
    -
      module: ejabberd_http
      port: 5443
      tls: true
      certfile: "/etc/ejabberd/example.com.pem"
      request_handlers:
        "": mod_http_upload

  access:    # add following lines in access section
    soft_upload_quota:
      all: 1000 # MiB
    hard_upload_quota:
      all: 1100 # MiB

  modules:  #add following lines in modules section 
      mod_http_upload:
      docroot: "/home/xmpp/upload"
      put_url: "http://@HOST@:5443"

upload file on this url (according to your setting url) http://@HOST@:5443 as you do in ruby on rails .For more detail about configuration of module check this link- https://github.com/processone/ejabberd-contrib/blob/master/mod_http_upload/README.txt

after uploading file you can send link(url) to user for downloading file.