Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 700
Siddhartha Narang Avatar asked Sep 25 '22 07:09

Siddhartha Narang


1 Answers

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.

like image 87
Sunil Singh Avatar answered Sep 28 '22 07:09

Sunil Singh