Articles in this section
Category / Section

How to retrieve the selected file details from "FileSelect" event arguments in UploadBox?

1 min read

The FileSelect event is triggered when the file is selected for upload successfully. In that event argument, you can get the selected file details of the UploadBox control. You have to declare the FileSelect event of the UploadBox as illustrated in the following code example.

CSHTML

@Html.EJ().Uploadbox("UploadEvents").ClientSideEvents(e => e.FileSelect("fileselect"))

 

 JavaScript

<script>
    function fileselect(arg) {
        console.log(arg[0]);
    }
</script>

 

From the above code arg [0], you can get the following file details.

Name

Type

Description

argument

Object

Event parameters in arg[0]

  1. extension - File Extension
  2. name - File Name
  3. rawFile - Raw File details
  4. size - File Size

 

Other parameters in the argument:

Name

Type

Description

cancel

 

 

 

Boolean

 

 

Set cancel as true for the event to be cancelled, otherwise set as false.

model

 

 

 

object

 

Returns the UploadBox model

type

 

string

 

Returns the name of the event.

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied