Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to implement a custom naming convention for images uploaded by the ASPxHtmlEditor

$
0
0

There are three places to make changes to implement your own naming convention for images uploaded by ASPxHtmlEditor.

If you load an image “from your computer” you can set the file name in a SaveUploadFile method of the InsertImageForm class. To find this method, copy the default dialog forms to your web project and view the InsertImageForm.ascx.cs file.

Please note that the names of uploaded images must be unique.

If the ASPxHtmlEditor.SettingsImageSelector and ASPxHtmlEditor.SettingsImageSelector.UploadSettings are enabled, you can change a file name in the ImageSelectorFileUploading event handler.

Lastly, if you load an image “from the web (URL)" you have to save a file name directly and change its name after it is saved on a server.

To do this: first, on Page_Load, store an uploaded image file name and file extension. Then, handle the CustomJSProperties event to send the filename and your image name pattern to the client-side. Handle the OnCommandExecuted client-side event and set the image’s tag src parameter in the html text of the ASPxHtmlEditor. And, rename the Page_Unload uploaded image according to your pattern.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>