【问题标题】:Quickblox Message AttachmentsQuickblox 消息附件
【发布时间】:2015-02-24 17:10:11
【问题描述】:

关于这个问题:quickblox web how to upload profile picture

我想将上传的文件附加到新邮件中。

 QB.content.createAndUpload({file: profile_picture, public: true}, function(error, response) {
     if (error) {
         console.log("upload didn't work");
     } else {
         var blob_id = response.id;
         // Example HERE //
         var attachment = {
           id: response.id.toString(),
           name: response.name,
           type: "photo",
           url: response.path,
           name: response.name,
           'content-type': response.content_type
          };
         QB.chat.message.create({
           attachments: [attachment]
         },...)
     }
 });

消息已创建(见下图),但名称和内容类型值未保存到 quickblox。下面的照片显示了一个使用 Q-municate 应用程序附加的文件,第二个内容来自上面引用的代码。你能告诉我正确的是在聊天消息中添加附件吗?谢谢

http://imgur.com/9QKNtXh

【问题讨论】:

    标签: quickblox


    【解决方案1】:

    正确的方法是记录 response 并检查 response.nameresponse.content_type - 由于某种原因它们可能为空 p>

    在这种情况下,您可以手动设置它们左右:

    var attachment = {
               id: response.id.toString(),
               name: response.name,
               type: "photo",
               url: response.path,
               name: "my image",
               'content-type': "image/jpeg",
              };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多