Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

MarkLogic doesn't recognize mime type of file

$
0
0

I'm building an application that inserts documents into MarkLogic server using the MLPHP library. The problem is when I insert a binary document, for example a PDF. The mime type will not be set properly, therefore the file cannot be opened as it should.

This is the code I use to insert a document:

// initialize REST client$client = new MLPHP\RESTClient('127.0.0.1', 8010, 'v1', '', 'rest-writer-user', 'writer-pw');// create new document and load content$doc = new MLPHP\Document($client);$doc->setContentType("application/pdf"); $doc->setContentFile("demo.pdf"); $doc->write('pdf_demo');

This is a dump of the $doc object after submitting to the server:

And here we have the inserted document in the search results:

But as expected, the browser cannot handle the file due to the wrong mimetype:

Anyone has got a clue what's going wrong here?


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>