2017-09-05 44 views
0

我正在開發ui5中的應用程序。 '模型'是一個筆記數據庫。現在,我通過JSON獲取筆記文檔。我想在ui5的上傳集合中顯示附件。 JSON正在返回附件,但我無法理解它。對於例如我附加了一個PDF文檔,但JSON顯示爲我附加了3個不同的文件。該文件也是Base64格式。ui5應用程序中附件的問題,Notes數據庫作爲後端

我希望能夠下載和上傳附件。

以下是在JSON的附件欄細節(只有1場沒有別的文件「多米諾訪問Service.pdf」):

"Attach_ProductDetails": 
    { 
     "type":"multipart", 
     "content":  [ 
        { 
      "contentType":"multipart\/mixed; Boundary=\"0__=4EBB0B01DFD9A4D28f9e8a93df938690918c4EBB0B01DFD9A4D2\"" 
      }, 
        { 
      "contentType":"multipart\/alternative; Boundary=\"1__=4EBB0B01DFD9A4D28f9e8a93df938690918c4EBB0B01DFD9A4D2\"", 
      "boundary":"--0__=4EBB0B01DFD9A4D28f9e8a93df938690918c4EBB0B01DFD9A4D2" 
      }, 
        { 
      "contentType":"text\/plain; charset=US-ASCII", 
      "data":"       (See attached file: 1. Domino Access Service.pdf)", 
      "boundary":"--1__=4EBB0B01DFD9A4D28f9e8a93df938690918c4EBB0B01DFD9A4D2" 
      }, 
        { 
      "contentType":"text\/html; charset=US-ASCII", 
      "contentDisposition":"inline", 
      "data":"<html><body><i>(See attached file: 1. Domino Access Service.pdf)<\/i><\/body><\/html>\r\n", 
      "boundary":"--1__=4EBB0B01DFD9A4D28f9e8a93df938690918c4EBB0B01DFD9A4D2" 
      }, 
        { 
      "contentType":"application\/pdf; name=\"1. Domino Access Service.pdf\"", 
      "contentID":"<[email protected]>", 
      "contentDisposition":"attachment; filename=\"1. Domino Access Service.pdf\"", 
      "contentTransferEncoding":"base64", 
      "data":"<Base64 data>", 
      "boundary":"--0__=4EBB0B01DFD9A4D28f9e8a93df938690918c4EBB0B01DFD9A4D2" 
      } 
     ] 
    } 

這將是很大的幫助,如果任何人有解決方案相同。

回答

0

它沒有給你三個文件。它向您展示了名爲Attach_ProductDetails的富文本字段的兩個替代渲染,其中包含代表附加文件的圖標 - 它認爲您可能需要。該富文本字段中還可能有其他數據。 API不知道你想要什麼,所以它給你提供了一切 - 如果你不準備處理text/html,它也會給你一個文本/純文本渲染。

它還爲您提供文件附件數據,標記爲「application/pdf」內容類型。您需要解碼base64數據並存儲它,以便您可以顯示它(或其他應用程序想要使用的數據)。

相關問題