uploader icon indicating copy to clipboard operation
uploader copied to clipboard

Dynamic URL for POST'in

Open prabhupravin opened this issue 7 years ago • 4 comments

Hi,

i might need to upload a file to different URLs basis of a radio button selected on screen

for e.g. if CSV is selected then i upload to 'upload/csv' if XLS is selected then i uploads to 'upload/xls'

is this possible in the current release?

Regards, Pravin

prabhupravin avatar Jul 26 '18 07:07 prabhupravin

As far as i can see, at this moment it is not possible. Possible solutions: 1: fork the project and add a setUrl() method in DmUploader.prototype.methods, make sure to check if upload widget is idle

2: initialize 2 uploaders on different divs, hide or show the divs on radio button change

mcorten avatar Jul 26 '18 09:07 mcorten

Replace

// Ajax Submit
    file.jqXHR = $.ajax({ 
      url: file.widget.settings.url,

to

var _url = '';  
 if(  typeof(file.widget.settings.url)  === 'function'){  
    	_url = file.widget.settings.url();  
    }else{  
    	_url = file.widget.settings.url;  
    }  
    // Ajax Submit  
    file.jqXHR = $.ajax({  
      url: _url,

Then

$('.xxxx').dmUploader({  
      url: function(){  
        return url + '?id=' + $('.yyyy').val();  
      },

reason211 avatar Aug 01 '18 10:08 reason211

$('#drag-and-drop-zone').dmUploader().data().settings.url=[insert url here];

SapientHetero avatar Oct 26 '18 17:10 SapientHetero

$('#drag-and-drop-zone').dmUploader().data().settings.url=[insert url here];

Doesn't work for me.

itonohito avatar Jul 25 '22 00:07 itonohito