     addedfile: (file) ->
       @element.classList.add "dz-started" if @element == @previewsContainer
 
-      file.previewElement = Dropzone.createElement @options.previewTemplate.trim()
-      file.previewTemplate = file.previewElement # Backwards compatibility
-
-      @previewsContainer.appendChild file.previewElement
-      node.textContent = file.name for node in file.previewElement.querySelectorAll("[data-dz-name]")
-      node.innerHTML = @filesize file.size for node in file.previewElement.querySelectorAll("[data-dz-size]")
-
-      if @options.addRemoveLinks
-        file._removeLink = Dropzone.createElement """<a class="dz-remove" href="javascript:undefined;" data-dz-remove>#{@options.dictRemoveFile}</a>"""
-        file.previewElement.appendChild file._removeLink
-
-      removeFileEvent = (e) =>
-        e.preventDefault()
-        e.stopPropagation()
-        if file.status == Dropzone.UPLOADING
-          Dropzone.confirm @options.dictCancelUploadConfirmation, => @removeFile file
-        else
-          if @options.dictRemoveFileConfirmation
-            Dropzone.confirm @options.dictRemoveFileConfirmation, => @removeFile file
+      if @previewsContainer
+        file.previewElement = Dropzone.createElement @options.previewTemplate.trim()
+        file.previewTemplate = file.previewElement # Backwards compatibility
+
+        @previewsContainer.appendChild file.previewElement
+        node.textContent = file.name for node in file.previewElement.querySelectorAll("[data-dz-name]")
+        node.innerHTML = @filesize file.size for node in file.previewElement.querySelectorAll("[data-dz-size]")
+
+        if @options.addRemoveLinks
+          file._removeLink = Dropzone.createElement """<a class="dz-remove" href="javascript:undefined;" data-dz-remove>#{@options.dictRemoveFile}</a>"""
+          file.previewElement.appendChild file._removeLink
+
+        removeFileEvent = (e) =>
+          e.preventDefault()
+          e.stopPropagation()
+          if file.status == Dropzone.UPLOADING
+            Dropzone.confirm @options.dictCancelUploadConfirmation, => @removeFile file
           else
-            @removeFile file
-
-      removeLink.addEventListener "click", removeFileEvent for removeLink in file.previewElement.querySelectorAll("[data-dz-remove]")
+            if @options.dictRemoveFileConfirmation
+              Dropzone.confirm @options.dictRemoveFileConfirmation, => @removeFile file
+            else
+              @removeFile file
+
+        removeLink.addEventListener "click", removeFileEvent for removeLink in file.previewElement.querySelectorAll("[data-dz-remove]")
         
 
     # Called whenever a file is removed.
     removedfile: (file) ->
-      file.previewElement?.parentNode.removeChild file.previewElement
+      file.previewElement?.parentNode.removeChild file.previewElement if file.previewElement
       @_updateMaxFilesReachedClass()
 
     # Called when a thumbnail has been generated
     # Receives `file` and `dataUrl`
     thumbnail: (file, dataUrl) ->
-      file.previewElement.classList.remove "dz-file-preview"
-      file.previewElement.classList.add "dz-image-preview"
-      for thumbnailElement in file.previewElement.querySelectorAll("[data-dz-thumbnail]")
-        thumbnailElement.alt = file.name
-        thumbnailElement.src = dataUrl
+      if file.previewElement
+        file.previewElement.classList.remove "dz-file-preview"
+        file.previewElement.classList.add "dz-image-preview"
+        for thumbnailElement in file.previewElement.querySelectorAll("[data-dz-thumbnail]")
+          thumbnailElement.alt = file.name
+          thumbnailElement.src = dataUrl
 
     
     # Called whenever an error occurs
     # Receives `file` and `message`
     error: (file, message) ->
-      file.previewElement.classList.add "dz-error"
-      message = message.error if typeof message != "String" and message.error
-      node.textContent = message for node in file.previewElement.querySelectorAll("[data-dz-errormessage]")
+      if file.previewElement
+        file.previewElement.classList.add "dz-error"
+        message = message.error if typeof message != "String" and message.error
+        node.textContent = message for node in file.previewElement.querySelectorAll("[data-dz-errormessage]")
     
     errormultiple: noop
     

    addRemoveLinks: no

    # A CSS selector or HTML element for the file previews container.
    # If null, the dropzone element itself will be used
    previewsContainer: null
    


    # Receives `file`, `progress` (percentage 0-100) and `bytesSent`.
    # To get the total number of bytes of the file, use `file.size`
    uploadprogress: (file, progress, bytesSent) ->
      if file.previewElement
        node.style.width = "#{progress}%" for node in file.previewElement.querySelectorAll("[data-dz-uploadprogress]")

    # Called whenever the total upload progress gets updated.
    # Called with totalUploadProgress (0-100), totalBytes and totalBytesSent
