如何让用户在botframework中发送图像附件

时间:2018-05-25 08:06:12

标签: c# botframework

[Serializable]
public class VehicleForm
{
    [Prompt("When did this happen")]
    public DateTime LossDate { get; set; }

    [Prompt("Please upload proof image")]
    public byte Picture { get; set; }

我希望用户能够在bot框架中填写表单时包含图像。我将图片字段声明为字节,但在上传图片时没有工作。这有可能实现吗?如果有,请有人向我介绍如何去做吗?谢谢

1 个答案:

答案 0 :(得分:1)

这样做有sample in the SDK Repository

从示例中看,您需要使用AwaitableAttachment类型,请查看ImagesForm

// Attachment field has no validation - any attachment would work
public AwaitableAttachment BestImage;

// Attachment field is optional - validation is done through AttachmentContentTypeValidator usage
[Optional]
[AttachmentContentTypeValidator(ContentType = "png")]
public AwaitableAttachment SecondaryImage;