Dear sir/madam
i am using tinymce editor in my view and i am saving the image with other content written in editor.
the problem is when i show the content in view then all the content are displayed leaving the image.
Here is my code of controller
public JsonResult upload()
{
var file = Request.Files["file"];
var filename1 = Path.GetFileName(file.FileName);
string locationn = Server.MapPath(@"~/Uploads/img/" + filename1);
file.SaveAs(locationn);
return Json(new {location= Url.Content(Path.Combine("~/Uploads/img/" + filename1))}, JsonRequestBehavior.AllowGet);
}
this is View code
<div class="content table-responsive table-full-width">
<link href="~/Scripts/Uploadify/uploadify.css" rel="stylesheet" />
<script src="~/Scripts/UPLODIFY/jquery.uploadify.min.js" type="text/javascript"></script>
<script src="~/Scripts/tinymce/tinymce.min.js"></script>
<script>
tinymce.init({
selector: 'textarea',
height: 500,
theme: 'modern',
skin: "lightgray",
plugins: [
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
'searchreplace wordcount visualblocks visualchars code fullscreen',
'insertdatetime media nonbreaking save table contextmenu directionality',
'emoticons template paste textcolor colorpicker textpattern imagetools'
],
toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | image',
toolbar2: 'print preview media | forecolor backcolor emoticons ',
images_upload_url: '/Account/upload',
images_upload_credentials: true,
automatic_uploads: true
});
</script>
@*<script src="~/Scripts/jquery-1.10.2.js"> </script>
<script type="text/javascript">
$(function(){
$("[name=filee]").on("change", function ()
{
var file=$(this).val()
alert(file)
$.ajax({
type: 'get',
url: '/Account/upload'
});
});
});
</script>*@
@using (Html.BeginForm("AddNews", "Account", FormMethod.Post,new { enctype = "multipart/form-data"}))
{
<table class="table table-striped">
<tbody>
<tr><td>@Html.DropDownList("newstype",new SelectList(Enum.GetValues(typeof(newsportal.Models.newstype))),new {id="ntype"})</td></tr>
<tr><td>Date</td><td>@Html.TextBoxFor(Model => Model.datee, new { @type = "date",paceholder="select date"})</td></tr>
<tr><td>Country</td><td>@Html.TextBoxFor(Model => Model.country)</td></tr>
<tr><td>State</td><td>@Html.TextBoxFor(Model => Model.statee)</td></tr>
<tr><td>City</td><td>@Html.TextBoxFor(Model => Model.city)</td></tr>
<tr><td>Category</td><td>@Html.DropDownListFor(Model=>Model.cat, new SelectList(Enum.GetValues(typeof(newsportal.Models.category))),"Select Category")</td></tr>
<tr><td>SubCategory</td><td>@Html.TextBoxFor(Model => Model.subcat)</td></tr>
<tr><td>URL Title(only for hindi news)</td><td>@Html.TextBoxFor(Model=>Model.urltitle)</td></tr>
<tr><td>Enter The News Youtube Url</td><td>@Html.TextBoxFor(Model=>Model.videourl)</td></tr>
<tr><td>Title</td><td>@Html.TextAreaFor(Model => Model.title)</td></tr>
<tr><td>Content</td><td>@Html.TextAreaFor(Model => Model.content)</td></tr>
<tr><td>pic1</td><td><input name="f1" type="file" /></tr>
<tr><td>Writer</td><td>@Html.TextBoxFor(Model => Model.writ)</td></tr>
<tr><td><input type="submit" /></td></tr>
</tbody>
</table>
}
</div>
this is the view where i display the content
<pre>div class="content_bottom_left">
<div class="single_page_area">
<h2 class="">@ne.title</h2>
<div class="single_page_content">
<div class="post_commentbox"> <a href=@Url.Action("Home","News")>class="fa fa-user">@ne.datee</span> <a href="#">^__i class="fa fa-tags">@ne.cat</a> </div>
<img class="img-center" src=@ne.pic1 alt="" style="height:430px;">
@Html.Raw(ne.content)
</div>
What I have tried:
i didnot tried anything else laving this.