Hi guys,
I am trying to use Inline Editor to upload an image (only 6 KB) from my device local but its response failed with the status "Server responded with 0 code".
This is my code below:
ImageUploaderEditorViewModel : InlineEditorViewModel
public string GetDataUrl()
{
var urlHelper = new UrlHelper(HttpContext.Current.Request.RequestContext);
if (ImageType == ImageTypeEnum.Attachment)
{
return urlHelper.Kentico().AuthenticateUrl(urlHelper.Action("Upload", "ImageUploader", new{
pageId = HttpContext.Current.Kentico().PageBuilder().PageIdentifier
}), false).ToString();
}
if (ImageType == ImageTypeEnum.MediaFile)
{
return urlHelper.Kentico().AuthenticateUrl(urlHelper.Action("Upload", "MediaFileImageUploader",new{
libraryName = MediaLibraryName
}), false).ToString();
}
return null;
}
**_ImageUploaderEditor.cshtml**
@using (Html.Kentico().BeginInlineEditor("image-uploader-editor", Model.PropertyName,
new
{
@class = "image-uploader-editor",
data_url = Model.GetDataUrl(),
data_file_type = Model.ImageType == ImageTypeEnum.MediaFile ? "media" : "attachment"
}))
{
<div class="@GetContainerClass()">
<div class="uploader">
<div class="dz-message @GetMessagePositionClass()">
<i class="icon-arrow-up-line"></i>
<div>
@Model.TextMessage <a class="dz-clickable">click</a> to browse
</div>
</div>
</div>
</div>
}
I am not sure there is anything wrong here or if I missed any config.
Can anyone have an idea what is the issue I get?