How to attach documents using dojox.fom.Uploader

386
0
02-21-2017 09:37 AM
JoseSanchez
Occasional Contributor III

Hello everyone,

I was able to upload documents associated to a feature using the uploader from "dojox.form.Uploader".

To understand how the uploader works I recommend to take a look to this sample and using it as a template as I did.

 http://jsfiddle.net/joshuaboshi/38B55/

Instead of using the form "UnloadFile.php"  I am using an aspx form, for that I just created a new aspx form :

"UploadFile.aspx"

This is the javascript code inside Widget.js:

this.form = domConstruct.create('formUpload', {
method: 'post',
enctype: 'multipart/form-data',
class: 'Uploader'

}, this.editPopup.domNode.children[0].children[1].children[0].children[0].children[2]);


this.up = new Uploader({
label: 'Browse',
multiple: true,
url: "UploadFile.aspx?PROJECTID="
}).placeAt(this.form);

this.up.startup();

this.txtBox = new dijit.form.TextBox({
name: "PROJECTID",
value: "" /* no or empty value! */,
placeHolder: "PROJECTID"
},"PROJECTID").placeAt(this.form,'last');

this.txtBox.set("value", "hello");


this.btn = new Button({
label: 'Upload',
onClick: lang.hitch(this,function() {
var concatenateURL = "".concat("UploadFile.aspx?PROJECTID=" , this.globalPROJECTID);
this.up.set("url", concatenateURL);
this.up.upload( );
})
}).placeAt(this.form);

0 Kudos
0 Replies