Fix some issues with uploading images. Add CSRF, fix ID and URL handling.