Multiple links on remote upload doesn't work

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
Hello. I just noticed that the remote upload feature only downloads the first file in the list when the script is configured to perform the downloads in background. Here is the cause:

In the file _uploader_javascript.inc.php the javascript function urlUploadFiles is called. This function make a list of valid urls and submit the first url to the server using the function startRemoteUrlDownload. The response should call the function updateUrlProgress, which will call startRemoteUrlDownload again with a different index.

The problem is that the function startRemoteUrlDownload gets the url list from the form field, but at the end it makes the field empty by calling $('#urlList').val(''). Also in my code the variables totalUrlItems and currentUrlItem aren't being parsed as global variables if I use the word "var" on them. I have no idea of why but they behave as global without the "var".


Here is how to fix it:

Comment the lines urlList = $('#urlList').val(); and urlList = findUrls(urlList); in the function startRemoteUrlDownload and make urlList global.


By the way, to make storage servers download the links you should replace file::getUploadUrl() with file::getUploadUrl($fileServerId) in this javascript, otherwise the main server will be the only one to download the links. $fileServerId should be the server id.