Current filter:
                                You should refresh the page.
                                Show all comments
                                • Carla Núñez Fernandez 03.21.2014

                                  Hello, where is the solution?
                                  Best regards

                                • Dennis (DevExpress) 03.21.2014

                                  @Carla: This functionality is not yet implemented as part of our FileAttachment.Web module. It is possible, however, to provide a custom PropertyEditor for editing IFileData properties that will support file type filter settings from the model. In general, use the same approach you would implement in a regular ASP.NET app. Once you have a custom web user control working as you require, you can wrap it into a PropertyEditor for the use in XAF Views.

                                • Stefano Oliva 04.23.2014

                                  I think this functionality could be very useful for several developers.
                                  Please add it next version of XAF suite.
                                  BTW I'm trying to do as you suggested because I need to achieve two results:

                                  1. Limit file size with user friendly message
                                  2. Limit file types during file selection
                                  Any suggestion is appreciated.
                                • Dennis (DevExpress) 04.23.2014

                                  @Stefano: Thank you for your feedback.
                                  If I understand you correctly, you are implementing a custom PropertyEditor, as suggested above. You can find our ASPxUploadControl control helpful here. Feel free to contact our ASP.NET team in case of any difficulties with customizing this control and drop me a line if you experience any specific difficulties while integrating it in XAF.

                                • Yuwono 05.21.2014

                                  I'm looking for the same functionality but must be done in client's browser. Like this . Please suggest, thank you.

                                • Dennis (DevExpress) 05.21.2014

                                  @Yuwono: The solution is the same - implement a custom PropertyEditor  based on a required visual control.

                                • John Zhang 01.22.2015

                                  I need filefilter funtion for xaf web application as well. is this feature still not implemented, and when? if have any alternative sample code for this feature?

                                • Dennis (DevExpress) 01.23.2015

                                  @John: This functionality is not yet implemented and above we suggested to implement a custom PropertyEditor for this task. Please check out the corresponding documentation to learn more on this concept. Thanks.

                                • John Zhang 01.23.2015

                                  is this means I need create a customized propertyeditor based on ASPxUploadControl ?

                                • Dennis (DevExpress) 01.23.2015

                                  Yes, you can use the ASPxUploadControl Class if this meets your business needs.

                                1 Solution

                                Creation Date Importance Sort by

                                Imagine a scenario where you need to allow an end-user to upload only image files with specific extensions, e.g. "*.jpg" and "*.png".
                                Currently, the FileTypeFilterAttribute  is supported in XAF Windows Forms applications only. So, it does not affect the Open dialogs invoked from XAF ASP.NET applications.

                                To accomplish this task, you can access the ASPxUploadControl Class instance that is used in an XAF Web application to show an open-file dialog and set its UploadControlValidationSettings.AllowedFileExtensions Property to a required value in accordance with its documentation.

                                There are two most common ways to access the underlying upload control for such customizations:

                                1. Access the control of FileDataPropertyEditor from ViewController when it is dynamically created for a required View: Extend Functionality > Access Editor Settings;
                                2. Create a custom PropertyEditor (based on ASPxUploadControl or any other suitable control) and use it for required IFileData properties.

                                The code snippet below illustrates the first solution in action:

                                using DevExpress.ExpressApp; using DevExpress.ExpressApp.FileAttachments.Web; using DevExpress.Web; using System; namespace MyUploadSolution.Module.Controllers { public class MyUploadController : ViewController<DetailView> { FileDataPropertyEditor propertyEditor; protected override void OnActivated() { base.OnActivated(); propertyEditor = View.FindItem("File") as FileDataPropertyEditor; if (propertyEditor != null) propertyEditor.ControlCreated += propertyEditor_ControlCreated; } private void propertyEditor_ControlCreated(object sender, EventArgs e) { FileDataEdit control = ((FileDataPropertyEditor)sender).Editor; if (control != null) control.UploadControlCreated += control_UploadControlCreated; } private void control_UploadControlCreated(object sender, EventArgs e) { ASPxUploadControl uploadControl = ((FileDataEdit)sender).UploadControl; uploadControl.ValidationSettings.AllowedFileExtensions = new String[] { ".jpg", ".png" }; } protected override void OnDeactivated() { base.OnDeactivated(); if (propertyEditor != null) propertyEditor.ControlCreated -= propertyEditor_ControlCreated; } } }

                                The "Custom Files" item here filters all files except "*.jpg" and "*.png".