mod_http_upload PUT/GET urls

Hi,

Could you please help me modify the URL construction code to build different URLs for PUT and GET?

Using the below code, I can get http://domain/UserDir/Filename :

       URL = str:join([GetPrefix, UserDir, FileName], <<$/>>),

This line is in the store_file function:

store_file(Path, Data, FileMode, DirMode, GetPrefix, Slot, Thumbnail) ->
    case do_store_file(Path, Data, FileMode, DirMode) of
	ok when Thumbnail ->
	    case identify(Path) of
		{ok, MediaInfo} ->
		    case convert(Path, MediaInfo) of
			{ok, OutPath} ->
			    [UserDir, RandDir | _] = Slot,
			    FileName = filename:basename(OutPath),
			    URL = str:join([GetPrefix, UserDir, FileName], <<$/>>),

This works for both PUT and GET. It works fine and I can upload the files. However I want to remove the UserDir part from the GET url. I want it to return http://domain/Filename but I am lost.

Could you please give me some pointers on how to do this?

Thank you in advance.

Then put: URL =

Then put:
URL = str:join([GetPrefix, FileName], <<$/>>),

Hi Badlop, Thank you so much

Hi Badlop, Thank you so much for your reply. I did this and it changed both of the Put and Get urls. Is it possible to have something similar to the following:

URL = str:join([GetPrefix, UserDir, FileName], <<$/>>),
and
URL = str:join([GetPrefix, FileName], <<$/>>),

and use the first URL for Put and the second URL for Get?

Thank you in advance.

Looking at the code, the

Looking at the code, the function store_file is called only by the function process when method = 'PUT'. So, maybe the code you want to change is somewhere else?

Hi ! I'm working on a pretty

Hi !
I'm working on a pretty similar issue, trying to make the http_upload module to work as intented.
However, when trying to put a file on my server, I always get a "404 error : not found", and thus I can't upload anything.
Could you send me your ejabberd.yml file so I can check how you managed to make it work ?

Thanks !

Syndicate content