Nov 26, 2018, 4:03 PM
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...
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.