javascript - 如何将复杂json对象中的图像从js上传到asp?
问题描述
我可以将带有formdata的图像从js发送到asp web api但是当图像作为属性在对象中时我不知道如何使用json对象
我在asp中有这些类:
public class SessionExam
{
public int id { get; set; }
public decimal max { get; set; }
public decimal min { get; set; }
public int duration { get; set; }
public List<SessionExamQuestion> questions { get; set; }
}
public class SessionExamQuestion
{
public int id { get; set; }
public string text { get; set; }
public decimal mark { get; set; }
public List<SessionExamQuestionOption> options { get; set; }
public byte[] image { get; set; }
}
public class SessionExamQuestionOption
{
public int id { get; set; }
public string text { get; set; }
public bool isRight { get; set; }
}
SessionExamQuestion 类具有作为字节数组的图像属性
如何使用 ajax 将图像从 javascript 发送到 asp web api?
我曾经将图像作为多部分发送到 asp
提前谢谢你们
解决方案
推荐阅读
- msal - 如何使用 MSAL 获取访问令牌
- node.js - 如何使用 facebook-nodejs-business-sdk 将 CTA 添加到 adcreative?
- python - 如何为 Atom 设置 python-linter
- php - 如何使用 Codeigniter Rest Api 上传图像和元数据
- sql - 如何通过使用单个列值的多个子字符串来选择 SQL 表中的行?
- gradle - ionic 3 应用程序中的任务“:app:checkDebugDuplicateClasses”执行失败
- javascript - 按钮限制警报弹出框标题
- javascript - 不断更新用单例创建的对象的属性是否存在问题?
- r - R中的蒙特卡罗模拟棒球比赛
- javascript - 在 Reactjs 中为条件组件设置动画以滑入、淡入