                         setTimeout(check, 100)
                 check()
 
-uploadUrl = (url) ->
+pendingUrls = []
+uploadUrls = (urls) ->
     if albumAttached
         albumUI.querySelector('.button').classList.add('hidden')
         albumUI.querySelector('.status').classList.remove('hidden')
         albumUI.querySelector('.status').textContent = 'Processing, please wait...'
         albumUI.querySelector('.result').classList.add('hidden')
-    dropArea = document.getElementById('droparea')
-    dropArea.style.overflowY = 'scroll'
-    dropArea.classList.add('files')
-    fileList = document.getElementById('files')
     if Object.keys(uploadedFiles).length == 0
         document.getElementById('files').innerHTML = ''
-
-    file = new MediaFile(url)
-    fileList = document.getElementById('files')
-    file.preview = createPreview(file.name)
-    fileList.appendChild(file.preview)
-    file.preview = fileList.lastElementChild
-    file.loadPreview()
+        dropArea = document.getElementById('droparea')
+        dropArea.style.overflowY = 'scroll'
+        dropArea.classList.add('files')
+        fileList = document.getElementById('files')
+    pendingUrls.push(url) for url in urls
+    updateQueue()
+
+uploadUrlFile = (file) ->
+    oldHash = file.hash
     API.uploadUrl(file, (result) ->
-        file = result.file
+        uploadedFiles[file.hash] = file
         if result.error?
             file.setError(result.error)
             return
+        file = result.file
+        delete uploadedFiles[oldHash]
         uploadedFiles[file.hash] = file
         if file.status == 'done'
             finish(file)
         else
+            file.isUserOwned = true
             worker.postMessage({ action: 'monitor-status', hash: file.hash })
     )
 

        text = e.clipboardData.getData('text/plain')
        if text
            if text.indexOf('http://') == 0 or text.indexOf('https://') == 0
                uploadUrl(text)
            else
                # todo: plaintext
        else

            mediaFile.updateStatus('local-pending')
            uploadedFiles[mediaFile.hash] = mediaFile
        )(file)
    for url in urls
        ((url) ->
            mediaFile = new MediaFile(url)
            mediaFile.preview = createPreview(mediaFile.name)
            _ = scrollingContainer.scrollTop
            fileList.appendChild(mediaFile.preview)
            scrollingContainer.scrollTop = _
            mediaFile.preview = fileList.lastElementChild
            mediaFile.loadPreview()
            mediaFile.hash = new String(guid())
            mediaFile.updateStatus('local-pending')
            uploadedFiles[mediaFile.hash] = mediaFile
        )(url)
    if pendingFiles.length + pendingUrls.length > 0
        setTimeout(updateQueue, 500)
    if files.length > 0
        uploadPendingFiles()
