-
19 Nov 2008 7:56 AM #581
File uploadpanel
File uploadpanel
Hi saki,
I have done code for one by one upload
But I want to call requestProgress(); method atleast one time while uploading to get file Size when upoading starts. It fails if file is small.Code:,manageUpload:function(){ var recordIndex = this.store.find( 'status', 0, 0 ); if(recordIndex != -1){ var record = this.store.getAt(recordIndex); this.uploadFile(record, this);if(true === this.enableProgress) { this.startProgress(); } }}
How can i get file size from the server for every upload?
Thanks
-
19 Nov 2008 11:10 AM #582
It depends on your server implementation but generally you can send an Ajax request and process the response which should contain the size.
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
20 Nov 2008 9:03 AM #583
Hi Saki...
First: Nice work and nice support! Keep on the good work!
I've got a (i doubt very stupid) problem - I'm working on a Connection to our CMS to upload files with the UploadPanel...
My Object looks like this:
[CODE]
this.pn_Upload = new Ext.ux.UploadPanel
({
url:'/cgi-bin/index.pl',
cmd: 'upload',
id:'up_upload' + this.instanceName,
path:'root',
baseParams:
{
SID: this.sid,
COMMAND: 'INTOS_V5_UPLOADPANEL',
},
singleUpload: false,
enableProgress: false,
clickRemoveText:'Hier klicken zum entfernen.',
addText:'HinzufR2D2 aka Stephan Baltzer
iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)
-
20 Nov 2008 9:54 AM #584
baseParams should be propagated down to FileUploader:
You can check if they really are.PHP Code:// create uploader
var config = {
store:this.store
,singleUpload:this.singleUpload
,maxFileSize:this.maxFileSize
,enableProgress:this.enableProgress
,url:this.url
,path:this.path
};
if(this.baseParams) {
config.baseParams = this.baseParams;
}
this.uploader = new Ext.ux.FileUploader(config);
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
21 Nov 2008 12:12 AM #585
I did... And even in the Ext.ajax.Request they still exist... But i can't get them on the serverside and even the Firebug Console ( I can see the request ONLY under network ) tells me there are no post request params...
EDIT!!!!!!!!!!!!!
TESTED IN CHROME (SINCE I GOT SOME IE-BUGS, I CAN'T USE IE FOR TESTING) - IT SEEMS TO WORK - I'M GETTING THE SID PARAM...
IS THIS A FIREFOX V3 BUG???
EDIT2!!!!
GR2D2 aka Stephan Baltzer
iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)
-
21 Nov 2008 2:56 AM #586
Sorry for my shouting ^^ This made me crazy... Uploads working fine!
I've got something to contribute i'm missing:
Why is there no filefinished event? I relayed it down and it works really nice!!!
Maybe you can use it!Code:this.uploader = new Ext.ux.FileUploader(config); // relay uploader events this.relayEvents(this.uploader, [ 'beforeallstart' ,'allfinished' ,'filefinished' // i think its very helpful ,'progress' ]); // install event handlers
R2D2 aka Stephan Baltzer
iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)
-
21 Nov 2008 4:49 AM #587
And another contribution...
I couldn't find a way to examine the server responses for each, is there a way? If not, now there may be:
File: Ext.ux.FileUpload.js
andCode:/** * called for both success and failure. Does nearly nothing * @private * but dispatches processing to processSuccess and processFailure functions */ ,uploadCallback:function(options, success, response) { var o; this.upCount--; this.form = false; // process ajax success if(true === success) { try { o = Ext.decode(response.responseText); } catch(e) { this.processFailure(options, response, this.jsonErrorText); this.fireFinishEvents(options, response.responseText); return; } // process command success if(true === o.success) { this.processSuccess(options, response, o); } // process command failure else { this.processFailure(options, response, o); } } // process ajax failure else { this.processFailure(options, response); } this.fireFinishEvents(options, response.responseText); } // eo function uploadCallback
Code:/** * Fires event(s) on upload finish/error * @private */ ,fireFinishEvents:function(options, responseText) { if(true !== this.eventsSuspended && !this.singleUpload) { this.fireEvent('filefinished', this, options && options.record, responseText); } if(true !== this.eventsSuspended && 0 === this.upCount) { this.stopProgress(); this.fireEvent('allfinished', this); } } // eo function fireFinishEvents
You see i added the response.responseText as additional event parameter so i can return more than success:true from the server
(In our case i need to return the md5'ed filename for convienience ^^)
So i return a
{"success":true, "md5":{"myfile.csv":"2d4e9ab69526a036424c2596e4721e4e.csv"}}
and catch it from the response.responseText as third parameter in event filefinishR2D2 aka Stephan Baltzer
iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)
-
21 Nov 2008 5:18 AM #588
I have found when trying to debug HTTP with firebug, firebug can be extremely wrong sometimes. I settled on using a simple software proxy. You see the exact request, and the exact response.
http://www.siliconwold.com/intercept...eptor_home.htm
Download, start, point firefox to 127.0.0.1:81 for the proxy, and debug!
-
24 Nov 2008 4:22 AM #589
can someone confirm?
can someone confirm?
currently i debug my project and found that following in Ext.ux.FileTreePanel.js is never fired in Firefox 3.0.4:
Can someone confirm this?Code:/** * requests file download from server * @private * @param {String} path Full path including file name but relative to server root path */ ,downloadFile:function(path) { [...] var callback = function() { Ext.EventManager.removeListener(frame, 'load', callback, this); setTimeout(function() {document.body.removeChild(form);}, 100); setTimeout(function() {document.body.removeChild(frame);}, 110); }; Ext.EventManager.on(frame, 'load', callback, this); form.submit(); }
-
24 Nov 2008 9:46 AM #590
I've tested it while developing and it worked. This is important part as it cleans up hidden frame/form.
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video


Reply With Quote