       @fileInput.click()
       false
 
+    resetFileInputField: ->
+      form = @fileInput.parent()
+      @fileInput.remove()
+      $('<input type="file" name="coverphoto[original]" accept="image/*">')
+        .appendTo form
+      @fileInput = $("input[name='coverphoto[original]']", @$el)
+
+    handleCoverPhotoUpdated: (evt, dataUrl) =>
+      @form.submit() if @options.postUrl
+
     saveEdit: =>
-      @gatherImageData()
-      @form.submit()
+      dataUrl = @gatherImageData()
+      @resetFileInputField()
       @hideEditMenu()
       @endReposition()
+      @$el.trigger("coverPhotoUpdated", dataUrl)
       false
 
     cancelEdit: =>

        $(@$el).bind evt, handler

    bindEvents: ->
      @on "mouseleave", @hideActions
      @on "mouseenter", @showActions
      @on "mouseleave", @actionsContainer.selector, @hideActionsMenu

      dataUrl = @canvas[0].toDataURL("image/png")
      @hiddenImageInput.val(dataUrl)

      dataUrl

  $.fn.CoverPhoto = (data) ->
    @each ->
      new CoverPhoto
