Skip to content

Commit 4ba737c

Browse files
committed
add filename to upload error message
1 parent 823401a commit 4ba737c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/controllers/posts_controller.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,12 @@ def handle_form_submit(params, view)
211211
end
212212
rescue => e
213213
@image.destroy
214-
flash.now[:alert] = "Error uploading file: #{e}"
214+
upload_filename = ""
215+
begin
216+
upload_filename = path_for(@image.blob).split("/").last
217+
rescue
218+
end
219+
flash.now[:alert] = "Error uploading #{upload_filename}: #{e}"
215220
end
216221
else # attachment does not exist
217222
flash.now[:alert] = "You did not choose a file to upload"

0 commit comments

Comments
 (0)