This example is a standalone illustration of the File Upload - AJAX Uploading demo. It illustrates how to upload a file via the MVC UploadControl Extension.
- Specify the UploadControl settings: define the Name property and the CallbackRouteValues.Action method that should handle the file uploading;
- Wrap the UploadControl definition/PartialView within a form in order to post the selected file into the server memory;
- Introduce any custom trigger that should upload a file on demand, for example, the MVC Button Extension;
- Handle the client-side Button Click event. Call the client-side Upload method to post the selected file into the server memory;
- Handle the CallbackRouteValues.Action method. Retrieve the posted file via the UploadControlExtension.GetUploadedFiles method. Specify the uploading ValidationSettings and the "UploadComplete" handler as parameters;
- Handle the "UploadComplete" handler and save the posted file.
If it is necessary to pass any information to the client:
- Use the "UploadComplete" event handler's e.CallbackData property (take special note of the character case);
- Retrieve the passed information in the client-side FileUploadComplete event handler via the e.callbackData property (take special note of the character case).
Question Comments
Added By: HanS Fadzli at: 5/12/2013 4:04:28 PM
how to upload via update panel......
Added By: Mike (DevExpress Support) at: 5/13/2013 12:13:41 AMWould you please create a new ticket in our Support Center regarding your inquiry?
Added By: Gail Clark at: 4/28/2015 6:39:37 PMyour solution work as expected, but why is it if I copy the code into another solution and add the javascript files, I get
ReferenceError: Can't find variable: aspxAddPressedItems
Added By: Gail Clark at: 4/28/2015 8:51:05 PMdo you guys have a version of this that work with asp.net 4, updating all the dll's is such a drama
Added By: Vladimir (DevExpress Support) at: 4/29/2015 12:58:26 AMHello,
To get the recent version of an example, you can try one of the following ways.
1. Select an appropriate example version using the third drop-down list and click the 'Example' hyperlink:
Download the *.dxsample file and change its extension to *.zip. After that you can use any ZIP archiver to unzip the example source code. Once you have done that, run Project Converter and upgrade the project.
2. Click "Example Runner" link on the right. Download and install DevExpress Example Runner. Then click the 'Example' link. As a result, the example source code will be downloaded and upgraded to the recent version of our products installed on your machine.