anchor.diff:  
   event(#submit{message={media_upload, EventProps}}, Context) ->
       File = z_context:get_q_validated("upload_file", Context),
  -    ContextUpload = case File of
  -                        #upload{filename=OriginalFilename, tmpfile=TmpFile} ->
  -                            Props = case proplists:get_value(id, EventProps) of
  -                                        undefined ->
  -                                            Lang = z_context:language(Context),
  -                                            Title = z_context:get_q("new_media_title", Context),
  -                                            NewTitle = case z_utils:is_empty(Title) of
  -                                                           true -> OriginalFilename;
  -                                                           false -> Title
  -                                                       end,
  -                                            [{title, {trans, [{Lang,NewTitle}]}},
  -                                             {language, [Lang]},
  -                                             {original_filename, OriginalFilename}];
  -                                        _ ->
  -                                            [{original_filename, OriginalFilename}]
  -                                    end,
  -                            handle_media_upload(EventProps, Context,
  -                                                %% insert fun
  -                                                fun(Ctx) -> m_media:insert_file(TmpFile, Props, Ctx) end,
  -                                                %% replace fun
  -                                                fun(Id, Ctx) -> m_media:replace_file(TmpFile, Id, Props, Ctx) end);
  +    case File of
  +        #upload{filename=OriginalFilename, tmpfile=TmpFile} ->
  +            Props = case proplists:get_value(id, EventProps) of
  +                        undefined ->
  +                            Lang = z_context:language(Context),
  +                            Title = z_context:get_q("new_media_title", Context),
  +                            NewTitle = case z_utils:is_empty(Title) of
  +                                           true -> OriginalFilename;
  +                                           false -> Title
  +                                       end,
  +                            [{title, {trans, [{Lang,NewTitle}]}},
  +                             {language, [Lang]},
  +                             {original_filename, OriginalFilename}];
                           _ ->
  -                            z_render:growl("No file specified.", Context)
  +                            [{original_filename, OriginalFilename}]
                       end,
  -
  -    %% Close the dialog and optionally perform the post upload actions
  -    z_render:wire({dialog_close, []}, ContextUpload);
  -
  +            handle_media_upload(EventProps, Context,
  +                                %% insert fun
  +                                fun(Ctx) -> m_media:insert_file(TmpFile, Props, Ctx) end,
  +                                %% replace fun
  +                                fun(Id, Ctx) -> m_media:replace_file(TmpFile, Id, Props, Ctx) end);
  +        _ ->
  +            z_render:growl("No file specified.", Context)
  +    end;
   
   event(#submit{message={media_url, EventProps}}, Context) ->
       Url = z_context:get_q("url", Context),
  
positive.code:                 _ ->
                      []
              end,
      ContextUpload = handle_media_upload(EventProps, Context,
                                          %% insert fun
                                          fun(Ctx) -> m_media:insert_url(Url, Props, Ctx) end,
                                          %% replace fun
                                          fun(Id, Ctx) -> m_media:replace_url(Url, Id, Props, Ctx) end),
  
      %% Close the dialog and optionally perform the post upload actions
      z_render:wire({dialog_close, []}, ContextUpload).
  
  
  
  
negative.code:                             end,
                      Actions2 = [add_arg_to_action({id, MediaId}, A) || A <- Actions],
                      z_render:wire([
                              {growl, [{text, ?__("Media item created.", ContextRedirect)}]},
                              {dialog_close, []} 
                              | Actions2], ContextRedirect);
                  {error, R} ->
                      z_render:growl_error(error_message(R, Context), Context)
              end;
        
          %% Replace attached medium with the uploaded file (skip any edge requests)
          N when is_integer(N) -> 
              case ReplaceFun(Id, Context) of
                  {ok, _} ->
                      z_render:wire([
                              {growl, [{text, ?__("Media item created.", Context)}]},
                              {dialog_close, []} 
                              | Actions], Context);
                  {error, R} ->
                      z_render:growl_error(error_message(R, Context), Context)
              end
      end.
  
  %% @doc Return a sane upload error message
  error_message(eacces, Context) ->
      ?__("You don't have permission to change this media item.", Context);
  error_message(file_not_allowed, Context) ->
      ?__("You don't have the proper permissions to upload this type of file.", Context);
  error_message(download_failed, Context) ->
      ?__("Failed to download the file.", Context);
  error_message(_R, Context) ->
      ?zWarning(io_lib:format("Unknown upload error: ~p", [_R]), Context),
      ?__("Error uploading the file.", Context).
  
  % Add an extra argument to a postback / submit action.
  add_arg_to_action(Arg, {postback, [{postback, {Action, ArgList}} | Rest]}) ->
  