def METHOD_NAME(task_id, files):
    import requests
    from app import models
    from app.plugins import logger
    from app.security import path_traversal_check
    def download_file(task, file):
        path = path_traversal_check(task.task_path(file['name']), task.task_path())
        download_stream = requests.get(file['url'], stream=True, timeout=60)
        with open(path, 'wb') as fd:
            for chunk in download_stream.iter_content(4096):
                fd.write(chunk)
    logger.info("Will import {} files".format(len(files)))
    task = models.Task.objects.get(pk=task_id)
    task.create_task_directories()
    task.save()
    try:
        downloaded_total = 0
        for file in files: 
            download_file(task, file)
            task.check_if_canceled()
            models.Task.objects.filter(pk=task.id).update(upload_progress=(float(downloaded_total) / float(len(files))))
            downloaded_total += 1
    except (requests.exceptions.Timeout, requests.exceptions.ConnectionError) as e:
        raise NodeServerError(e)
    task.refresh_from_db()
    task.pending_action = None
    task.processing_time = 0
    task.partial = False
    task.images_count = len(task.scan_images())
    task.save()