I'm trying to upload a file and send it to a java servlet using post method. My dojo is 1.8. Just started working with javascript and still have tons to learn. Please correct me if you can. So i have a couple of undefined attributes: label, UploaderID and dojo source path which is supposed to be true!
**************** REVISED CODE ***************************
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>dojox.form.Uploader</title>
<link href="dijit/themes/dijit.css" rel="stylesheet" />
<link href="dijit/themes/claro/Common.css" rel="stylesheet" />
<link href="dijit/themes/claro/form/Common.css" rel="stylesheet" />
<link href="dijit/themes/claro/form/Button.css" rel="stylesheet" />
<link href="dojox/form/resources/UploaderFileList.css" rel="stylesheet" />
<script type="text/javascript"
src="//ajax.googleapis.com/ajax/libs/dojo/1.8/dojo/dojo.js"
data-dojo-config="parseOnLoad: true, async: true,
isDebug: true,
packages: [{name: 'dojo', location: '.'},
{name: 'dijit', location:
'/dojo/dijit'},
{name: 'dojox', location:
'/dojo/dojox'},
]"></script>
<script>
dojo.require("dojo.domReady")
dojo.require("dijit.form.Button");
dojo.require("dijit.Dialog");
dojo.require("dijit.form.TextBox");
dojo.require("dojox.form.Uploader");
dojo.require("dojox.form.uploader.FileList");
dojo.require("dojo.parser");
});
</script>
</head>
<body class="claro">
<form method="post" action="user" id="myForm" enctype="multipart/form-data" >
<fieldset style="background-color:lightblue;">
<h1 id="greeting">User Administration</h1>
<p>First Name: <input type="text" name="fname" size="20">
LastName: <input type="text" name="lname" size="20"></p>
<input class="browseButton" name="uploadedfile" multiple="false"
type="file" data-dojo-type="dojox.form.Uploader" label="Select Some File"
id="uploader" />
<p><input type="submit" label="Submit" data-dojo-type="dijit.form.Button" />
</p>
<div id="files" data-dojo-type="dojox.form.uploader.FileList"
uploaderId="uploader"></div>
</fieldset>
</form>
</body>
</html>
Have set up the dojo.js correctly? How are you using your application? Have you downloaded the dojo source files in your machine or using some remote server. You can use the google CDN as show below. Also have look over here of setting your dojo source.
src="//ajax.googleapis.com/ajax/libs/dojo/1.8/dojo/dojo.js"
In addition to @Dmitri comments.
Remove the below line.
<script> dojoConfig ={isDebug:true, ParseOnLoad: true,};</script>
because you are redefining the dojoConfig in the very next line via. data-dojo-config
<script type="text/javascript" src="dojo/dojo.js"
data-dojo-config="async: true,isDebug: true,parseOnLoad: true"></script>
Also you can use the new AMD format for require() call as below.
<script type="text/javascript">
require([
"dojo/parser",
"dijit/form/Button",
"dijit/Dialog",
"dijit/form/TextBox",
"dojox/form/Uploader",
"dojox/form/uploader/FileList"
"dojo/domReady!"
], function (parser, Button, Dialog, TextBox, Uploader, FileList ) {
// now parse the page for widgets
parser.parse();
// Your code will go here
});
</script>