<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt;color:black">Hello,<br>
<br>
I attended the last webinar. I was asking the question reading uploading a GeoNode document through the REST Upload endpoint using JavaScript through the Web interface.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">I can upload a zipped shapefile (stored as a JavaScript variable) from the GeoNode Layers upload page using the GeoServer REST API endpoint.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From that same Uploads Layer page, I also have a document (also stored as a
<span style="background:white">JavaScript </span>variable) which I want to upload - this time in GeoNode.</span></b><span style="font-size:12.0pt;color:black"><br>
I basically want to upload the document as a GeoNode document using JavaScript.<br>
<br>
Last week, I have posted this question on Gitter as well. <br>
I found an earlier Gitter post focusing on this topic. <a href="https://gitter.im/GeoNode/general?at=60046313e578cf1e95f3bf7e">https://gitter.im/GeoNode/general?at=60046313e578cf1e95f3bf7e</a><br>
A method pointed out is from: <a href="https://stackoverflow.com/questions/20473572/django-rest-framework-file-upload">
https://stackoverflow.com/questions/20473572/django-rest-framework-file-upload</a><br>
However, someone else has pointed out that the above solution seems to work for DRF but is most likely not yet implemented [in GeoNode].<br>
<br>
<b>What does that mean that it is not implemented? Does it mean we can implement is using the code sample or does it mean that even if we implement the code, it wouldn’t work?<br>
</b><br>
Another aspect of this is that we want this upload feature to be secure. Since we are using javascript, we don’t want the credentials used for upload be visible in plaintext.<br>
Thus, is there a way we can get a token of the current logged-in user? <br>
<br>
I am just hoping to know if this is indeed implemented and if the approach pointed out is worth a try.<br>
<br>
Dr Pankaj Sharma<br>
Research Fellow<br>
Department of Environment<br>
The University of Auckland<br>
Auckland, New Zealand<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>