1. #581
    Ext User
    Join Date
    Nov 2008
    Posts
    88
    Vote Rating
    0
    sanraj is on a distinguished road

      0  

    Default File uploadpanel

    File uploadpanel


    Hi saki,

    I have done code for one by one upload

    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(); } }
    }
    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.

    How can i get file size from the server for every upload?

    Thanks

  2. #582
    Sencha - Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    26,168
    Vote Rating
    82
    jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold

      0  

    Default


    It depends on your server implementation but generally you can send an Ajax request and process the response which should contain the size.

  3. #583
    Ext User
    Join Date
    Nov 2007
    Location
    Cologne, Germany
    Posts
    19
    Vote Rating
    0
    iDevelopment is on a distinguished road

      0  

    Default


    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:'Hinzuf
    R2D2 aka Stephan Baltzer
    iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)

  4. #584
    Sencha - Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    26,168
    Vote Rating
    82
    jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold

      0  

    Default


    baseParams should be propagated down to FileUploader:
    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); 
    You can check if they really are.

  5. #585
    Ext User
    Join Date
    Nov 2007
    Location
    Cologne, Germany
    Posts
    19
    Vote Rating
    0
    iDevelopment is on a distinguished road

      0  

    Default


    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!!!!

    G
    R2D2 aka Stephan Baltzer
    iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)

  6. #586
    Ext User
    Join Date
    Nov 2007
    Location
    Cologne, Germany
    Posts
    19
    Vote Rating
    0
    iDevelopment is on a distinguished road

      0  

    Default


    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!!!

    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
    Maybe you can use it!
    R2D2 aka Stephan Baltzer
    iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)

  7. #587
    Ext User
    Join Date
    Nov 2007
    Location
    Cologne, Germany
    Posts
    19
    Vote Rating
    0
    iDevelopment is on a distinguished road

      0  

    Default


    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

    Code:
    	/**
    	 * 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
    and

    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 filefinish
    R2D2 aka Stephan Baltzer
    iDEDV - EDV-Entwicklungen Baltzer & Klein (CEO)

  8. #588
    Sencha User
    Join Date
    Feb 2008
    Location
    Illinois
    Posts
    142
    Vote Rating
    0
    carl23934 is on a distinguished road

      0  

    Default


    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!

  9. #589
    Ext JS Premium Member
    Join Date
    Mar 2007
    Posts
    629
    Vote Rating
    0
    Dumbledore is on a distinguished road

      0  

    Default 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:

    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();
    	}
    Can someone confirm this?

  10. #590
    Sencha - Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    26,168
    Vote Rating
    82
    jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold jsakalos is a splendid one to behold

      0  

    Default


    I've tested it while developing and it worked. This is important part as it cleans up hidden frame/form.