Hi Dave,

I created new mimetype with name text/binary and gave dat,prm as file extension 
with format as text, but still facing the same issue.

Thanks
Abhishek
________________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Dave Cassel 
[dave.cas...@marklogic.com]
Sent: Tuesday, October 13, 2015 1:24 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] File upload Issue

Abhishek, when you give MarkLogic a file, it attempts to figure out what type 
of file it is. In this case, you want it to be treated as text, but it's viewed 
as binary. In the Admin UI, click on Mimetypes on the left side. Any file 
extension that is not in that list is assumed to be a binary file. If you add a 
new mime type with the .dat extension and specify text format, I think what 
you're doing will work.

--
Dave Cassel<http://davidcassel.net>, @dmcassel<https://twitter.com/dmcassel>
Technical Community Manager
MarkLogic Corporation<http://www.marklogic.com/>
http://developer.marklogic.com/


From: 
<general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>>
 on behalf of 
"abhishek.srivas...@cognizant.com<mailto:abhishek.srivas...@cognizant.com>" 
<abhishek.srivas...@cognizant.com<mailto:abhishek.srivas...@cognizant.com>>
Reply-To: MarkLogic Developer Discussion 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Date: Saturday, October 10, 2015 at 11:24 AM
To: "general@developer.marklogic.com<mailto:general@developer.marklogic.com>" 
<general@developer.marklogic.com<mailto:general@developer.marklogic.com>>
Subject: [MarkLogic Dev General] File upload Issue

Hi All,

I am getting issue while uploading *.DAT file into MarkLogic. Have following 
content in file

TEST.DAT
-------------
ABC
RST
UVW
XYZ

upload.xqy
--------------
element result {
                element count 
{fn:count(fn:tokenize(xdmp:get-request-field("upload")/fn:string(),'&#13;&#10;'))},
                element count 
{fn:count(fn:tokenize(xdmp:get-request-field("upload")/fn:string(),'&#13;'))},
                element count 
{fn:count(fn:tokenize(xdmp:get-request-field("upload")/fn:string(),'&#10;'))},
                element content {xdmp:get-request-field("upload")/fn:string()}
}

ui.xqy
---------------
<html xmlns="http://www.w3.org/1999/xhtml";>
    <body>
    <form name="test" action="upload.xqy?uid={xdmp:random()}" method="post"
          enctype="multipart/form-data">
    <p><label>File to upload:
    <input type="file" class="name" name="upload" size="50"/></label></p>
    <p><input type="submit" value="Upload and Get Results"/></p>
    </form>
    </body>
  </html>

When I am trying to upload the file I am expecting tokenized count to be 4 and 
actual data of the file in <content/> where I am getting binary stream 
characters and count as 1.

Any suggestion will be well appreciated

Thanks
Abhishek [images] <http://www.linkedin.com/pub/abhishek-srivastav/17/147/775/>
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to