1. Download SinaEditor
2.JSP call page
where , src="<%=request.getContextPath() %>/edit/editor.htm represents the editor.htm file path in the downloaded SinaEditor; the two green IDs must be consistent
3. The downloaded editor contains img.htm and attach.htm. The first one is for uploading pictures, and the second one is for uploading attachments. Of course, both are used in the same way and can be regarded as uploads. file.
4. The following is an example of uploading images in img.htm. Make a note for future use.
function chk_imgpath () {
if($( 'radio1').checked==true){
if($("imgpath").value == "http://" || $("imgpath").value == "") {
window.close();
return;
}
LoadIMG($("imgpath").value);
}else{
if($("file1").value == "") {
alert("Please select the image file to upload!");
; > var filetype = filepath.substring(filepath.lastIndexOf('.'));
var regu = ".gif.jpg.png.jpge.GIF.JPG.PNG";
if (regu .indexOf(filetype) == -1) {
alert('Only .gif.jpg.png.jpge type files are allowed to be uploaded!');
return ;
}
var f = j ('#form1'); url: '/ask/fileUpload ? Type = Img ',
Datatype:' String ',
Success: Function (data) {
j ("#IMGPATH"). Attr ("value", data);
j (. "#radio1").attr("checked","true");
chk_imgpath();
$('divProcessing').style.display='';
},
error : function(data){
alert('File upload failed'); (No narration)