FileUploadField Change Direct Event Does not have file

  1. #1

    FileUploadField Change Direct Event Does not have file

    Hello,
    I am trying to determine which event i need to implement in order to upload a file following the selection of the file. I am currently using the Change DirectEvent, but it seems that the FileUploadField is empty during this event. The example is below.

    The view is...

    	@(X.FileUploadField ( )
    		.ID ( "BasicField" )
    		.Width ( 400 )
    		.Icon ( Icon.Attach )
    
    		.DirectEvents
    		( de =>
    		{
    
    			de.Change.Url = Url.Action ( "OnFileSelected" );
    		}
    		)
    	//.Listeners
    	//(
    	//	l =>
    	//	{
    	//		l.Change.Fn = "OnFileUploadChange";
    	//	}
    	//)
    	)
    and the controller call is...
            public ActionResult OnFileSelected ( )
            {
                Ext.Net.FileUploadField oFileUploadField
                    = this.GetCmp<Ext.Net.FileUploadField> ( "BasicField" );
    
                if ( oFileUploadField.HasFile )
                {
                    var o = oFileUploadField.PostedFile.InputStream;
                }
    
                Ext.Net.MVC.DirectResult oDirectResult
                    = new Ext.Net.MVC.DirectResult ( );
    
                oDirectResult.IsUpload = true;
    
                return oDirectResult;
            }
    Within the controller call, the FileUploadField is empty.
  2. #2
    Hello,
    I finally stumbled upon some online info that mentions it must be inside a form for it to work So i added it to a form and set the "isUpload:true" and it works. Thanks.

Similar Threads

  1. Replies: 6
    Last Post: Mar 26, 2015, 9:43 PM
  2. Checkbox Change direct event auto fire
    By Dharmesh in forum 2.x Help
    Replies: 0
    Last Post: Oct 15, 2014, 12:34 PM
  3. Replies: 0
    Last Post: Jun 14, 2013, 2:34 PM
  4. Replies: 3
    Last Post: May 15, 2012, 8:48 AM
  5. Replies: 0
    Last Post: Apr 19, 2012, 4:32 PM

Tags for this Thread

Posting Permissions