View Full Version : UploadDialog Widget
tim-tailor
28 Jun 2007, 7:54 AM
Hi
I luckily found the UploadManager from aconran, after hours trying to build something similar.
Its a great piece of work, but I am not able to get it work.
I have a simple serverside class, that prints all parameters when its called,
I use the sample code, which is provided,
ulDlg = new Ext.UploadDialog({
customForm: '<label for="file-title">Title:</label><input type="text" name="file-title" id="file-title" size="20" autocomplete="off"><br/>',
currFilesURL: 'http://localhost:8080/GEODrawing/uploader/currentuploads',
newFileURL:'http://localhost:8080/GEODrawing/uploader/showparams',
title: 'Sample Uploader'
});
}
but the only parameters I get are:
["file-title":["asd"], "action":"showparams", "controller":"uploader"]
(Action and Controller are framework depended and belonging to Grails)
In currentuploads I return a correct JSON, which is displayed correctly :-)
Hope you can give me a hand :-)
Thanks, Tim
tim-tailor
28 Jun 2007, 8:45 AM
Oh maybe I should point to the Widget I mean:
http://www.divergingpath.com/index.cfm/2007/4/1/Ext-UploadDialog-Widget-that-extends-from-LayoutDialog
Someone else already tried?
Thanks, Tim
tim-tailor
28 Jun 2007, 9:12 AM
Sorry of course my fault,
I missed a Server method: getFile()
Should work now
Thanks for reading ;-)
Tim
aconran
6 Jul 2007, 11:46 AM
Glad you got this working. I have a more recent version I'd like to post sometime soon. :-)
tim-tailor
7 Jul 2007, 12:59 AM
That sounds cool, hope you make it available as ux.UploadWidget In the user Extensions space in the wiki :-)
Looking forward to it :-)
Tim
oracio
16 Jul 2007, 2:24 AM
Hello,
first of all i'd like to say that this widget is really cool and time saving...
i'm pretty new to js and widgets like this are very helpful.
I don't speak english very well so i'll try to explain my problem as good and simple as I can.
now saying that, i encountered a problem and maybe someone can help me.
the examples in Aaron's site uses coldfusion as server side, i translated it to Classic ASP.
showing the current files in the grid via a JSON went fine, and also I was able to upload a file, but I see in the code that it needs to get a JSON response to be able to add a row in the files grid.
so I made a ASP script that uploads the file and in return writes the following JSON:
{"FILES": [{"NAME": "misc.jpg","SIZE": 87832,"TYPE": "JPEG Image","DTS": "16/07/2007 13:10:46","FILEURL": "../dim/day/misc.jpg","FILEEXISTED": "NO"}]}
for some reason the UploadDialog doesn't read it, i get "CurrRow has no properties" in the FireBug.
this is the code from Aaron's script that handles the Response:
Ext.extend(Ext.UploadDialog, Ext.LayoutDialog, {
uploadRequest : function() {
var upload = Ext.lib.Ajax.formRequest('x-upload-form',
this.newFileURL,
{upload: this.uploadResponse,
scope: this
},
null,
true,
true);
},
uploadResponse : function(response) {
var fileInfo = Ext.decode(response.responseText);
if (fileInfo['FILEEXISTED'] == 'NO') {
this.ds.add(new this.File({NAME: fileInfo['NAME'],
SIZE: fileInfo['SIZE'],
TYPE: fileInfo['TYPE'],
DTS: fileInfo['DTS']}), fileInfo['FILEURL']);
} else {
var currRow = this.ds.getById(fileInfo['FILEURL']);
currRow.beginEdit();
currRow.set('NAME', fileInfo['NAME']);
currRow.set('SIZE', fileInfo['SIZE']);
currRow.set('TYPE', fileInfo['TYPE']);
currRow.set('DTS', fileInfo['DTS']);
currRow.endEdit();
}
},
load : function(options) {
var options = options || {};
this.opts = options;
this.ds.load(options);
}
});
thank you,
- Uri
aconran
16 Jul 2007, 5:32 AM
Uri -
The problem is that you are returning JSON which is contained within a FILES array. You should just be returning the individual file after the upload like so:
{"NAME": "misc.jpg","SIZE": 87832,"TYPE": "JPEG Image","DTS": "16/07/2007 13:10:46","FILEURL": "../dim/day/misc.jpg","FILEEXISTED": "NO"}
I will try to get you an updated version of the UploadDialog widget soon.
Thanks,
Aaron Conran
oracio
16 Jul 2007, 5:52 AM
Awesome! :D
Thanks Aaron!
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.