The tinymce plug-in does not provide a free local image upload function. Therefore, you can integrate the uploadify plug-in into tinymce to implement local upload. You also use the jquery. ui plug-in to first display all the code.
<Script type => = convert_fonts_to_spans: rule: force_br_newlines: force_p_newlines: remove_linebreaks: relative_urls: resize :::::: function (img = + data + ). dialog (). dialog (</script> <div> <form method = action => <textarea id = name = style => </textarea> <input type = value =/> </form> </div> <div id = style => <input type = name = id =/> <label> only images in png, jpg, and gif formats smaller than 10 MB can be uploaded. </label> </div>View Code
Next we will analyze it in several steps
1. Add the Custom button on the tinymce plug-in first
View Code
2. initialize the uploadify plug-in.
::::::: Function (img = + data +). dialog (). dialog (View Code
3. Click the Custom button and enable the jquery-ui dialog plug-in to bring up the upload dialog box.
=View Code
Now the front-end is partially OK, followed by the back-end
1. The background receives images uploaded by users.
Result = folder = Server. mapPath (time = DateTime. now. toString (); extension = System. IO. path. getExtension (Filedata. fileName); newFileName = time + extension ;(! ++View Code
2. Receive the content of the tinymce plug-in (I will simply use NotePad to replace the database), and then read the content from notepad and present it to another page.
Path = Server. MapPath (str = RedirectToAction (str = System. IO. File. ReadAllText (Server. MapPath (=View Code
In mvc4, html-tagged content is not allowed to be uploaded to the background by default to prevent script attacks. Therefore, I created TinyMCEModels and added the AllowHtml tag to the content attribute (in System. web. in the Mvc namespace ).
Content {;View Code
Source http://files.cnblogs.com/guzhehang/TinyMCEUpload.rar