當前位置:首頁 » 文件管理 » aspnetckeditor上傳圖片

aspnetckeditor上傳圖片

發布時間: 2022-11-07 00:21:12

⑴ 急!急!急!asp.net ckeditor3.5.3如何實現添加圖片上傳功能!代碼越詳細越好,最好可以直接運行的!

ckeditor沒有具備上傳圖片功能,只有與ckfinder工具集成,才能實現,如果需要可以問我

⑵ ckeditor只能上傳網路圖片,如何設置能上傳本地圖片

現在的ckeditor更新了 要用上傳圖片的功能貌似還要收費你可以用fckeditor 這個跟ckeditor差不多,簡單配置後,就可以上傳圖片上傳後提交表單 _POST數組里有圖片的路徑 把它存到資料庫里就可以了詳細的方法可以看裡面的demo,很簡單的
知道了嗎。給分 走人 採納

⑶ ckeditor_4.5.3_standard +ckfinder_aspnet_2.5.0.1 上傳圖片配置問題! 請教大神配置步驟。。

web.config:

<appSettings>
<addkey="CKFinder:BasePath"value="~/你放置的目錄/ckfinder/"/>
<addkey="CKEditor:BasePath"value="~/你放置的目錄/ckeditor/"/>
<addkey="CKeditor:UserFilesPath"value="~/要上傳的目錄/"/>
.....
</appSettings>

⑷ ckeditor編輯器如何做復制圖片上傳(包括本地圖片及遠程圖片),以插件方式實現

這個復制圖片到編輯器中的問題 是跟瀏覽器有關系的.IE瀏覽器是不支持的 .firefox瀏覽器是支持的.但是firefox是將圖片給解析成base64的大字元串而不是圖片路徑.

⑸ 怎麼為ckeditor添加圖像

為ckeditor添加圖像的方法
1. 到官網下載ckeditor
2. 復制到java web項目目錄下
3. 配置config文件,打開圖片上傳功能

CKEDITOR.editorConfig = function (config) {
// 換行方式
config.enterMode = CKEDITOR.ENTER_BR;
// 當輸入:shift+Enter是插入的標簽
config.shiftEnterMode = CKEDITOR.ENTER_BR;//
//圖片處理
config.pasteFromWordRemoveStyles = true;
config.filebrowserImageUploadUrl = "ckUploadImage.action?type=image";

// 去掉ckeditor「保存」按鈕
config.removePlugins = 'save';
};

4. java後台處理代碼
// 上傳圖片
@Action(value = "/ckUploadImage", results = { @Result(name = "success", location = "/upload.jsp") })
public String uploadImages() throws Exception {
HttpServletRequest request = ServletActionContext.getRequest();
FileOutputStream fos;
String webRoot = request.getSession().getServletContext().getRealPath(
"");
// 獲取圖片後綴名
String partRightType = uploadFileName.substring(uploadFileName
.lastIndexOf("."));
String CKEditorFuncNum = request.getParameter("CKEditorFuncNum");
// 判斷圖片的格式
if (!ImageFile.checkImageType(partRightType)) {
String path = "";
String alt_msg = "Sorry! Image format selection is incorrect, please choose GIF, jpeg, PNG format JPG, picture!";
pringWriterToPage("<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction("
+ CKEditorFuncNum
+ ", '"
+ path
+ "' , '"
+ alt_msg
+ "');</script>");
} else {
try {
uploadFileName = DateUtils.getDateNoStyle() + "-"
+ UUID.randomUUID() + partRightType;
String savePath = webRoot + Constants.UPLOAD_IMAGES_PATH;
File uploadFilePath = new File(savePath);
if (uploadFilePath.exists() == false) {
uploadFilePath.mkdirs();
System.out.println("路徑不存在,但是已經成功創建了" + savePath);
} else {
System.out.println("路徑存在了" + savePath);
}
fos = new FileOutputStream(new File(savePath + uploadFileName));
FileInputStream fis = new FileInputStream(getUpload());
byte[] buffer = new byte[1024];
int len = 0;
while ((len = fis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
fos.close();
fis.close();
} catch (FileNotFoundException foe) {
System.out.println("上傳文件為0位元組");
}
// String path = "http://" + request.getServerName() + ":"
// + request.getServerPort() + request.getContextPath()
// + Constants.UPLOAD_IMAGES_PATH + uploadFileName;
String path = request.getContextPath()
+ Constants.UPLOAD_IMAGES_PATH + uploadFileName;
String alt_msg = "";
pringWriterToPage("<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction("
+ CKEditorFuncNum
+ ", '"
+ path
+ "' , '"
+ alt_msg
+ "');</script>");
}
return null;
}

* 其實重點的代碼就是這點
pringWriterToPage("<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction("
+ CKEditorFuncNum
+ ", '"
+ path
+ "' , '"
+ alt_msg
+ "');</script>");

⑹ ckeditor 怎麼上傳圖片 把上傳的圖片保存到伺服器 圖片名保存到資料庫

給你借鑒一下,新聞發布:
News_add.asp頁面代碼
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top">
<table width="95%" border="0" cellpadding="2" cellspacing="1" class="table_southidc">
<form method="POST" name="myform" onSubmit="return CheckForm();" action="News_save.asp?action=Add" target="_self">
<tr align="center">
<td class="back_southidc" height="30" colspan="2"><font color="#0000FF"><strong>新增新聞</strong></font></td>
</tr>
<tr bgcolor="#ECF5FF">
<td width="20%" height="24" align="right"><div align="left"><font color="#FF0000">*</font>新
聞標題:</div></td>
<td width="80%" valign="top">
<div align="left">
<input name="title" type="text" class="input" value="" size="50" maxlength="200">
</div></td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left"><font color="#FF0000">*</font>新聞類別:</div></td>
<td valign="top">
新聞大類:
<%
set rs= Server.CreateObject("ADODB.Recordset")
sql = "select * from BigClass_New"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "請先添加欄目。"
else
%>
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
dim selclass
selclass=rs("BigClassName")
rs.movenext
do while not rs.eof
%>
<option value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<select name="SmallClassName">
<option value="" selected>不指定小類</option>
<%
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from SmallClass_New where BigClassName='" & selclass & "'"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td align="right" valign="top"><div align="left"><font color="#FF0000">*</font>新聞內容:</div></td>
<td valign="top">
<input type="hidden" name="content" value="">
<iframe ID="eWebEditor1" src="Southidceditor/ewebeditor.asp?id=content&style=southidc" frameborder="0" scrolling="no" width="620" HEIGHT="405"></iframe>
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left">首頁圖片:
<input name="IncludePic" type="hidden" id="IncludePic" value="yes">
</div></td>
<td valign="top"><input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="" size="50" maxlength="200">
</td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left"><font color="#FF0000">*</font>發布人:</div></td>
<td valign="top">
<div align="left">
<input name="user" type="text" class="input" size="30" value="admin">
</div></td>
</tr>
<tr bgcolor="#ECF5FF">
<td height="24" align="right"><div align="left">首頁圖片新聞:</div></td>
<td>
<div align="left">
<input type="radio" value="true" name="OK">

<input type="radio" value="false" checked name="Ok">
否 <font color="#FF0000">(設為首頁圖片新聞,選擇此項時請注意文章中是否添加有圖片!)</font></div></td>
</tr>
<tr align="center" bgcolor="#ECF5FF">
<td height="35"><div align="left">錄入時間:</div></td>
<td height="35"><div align="left">
<input name="AddDate" type="text" id="AddDate" value="<%=date()%>" maxlength="50">
</div></td>
</tr>
<tr align="center" bgcolor="#ECF5FF">
<input type="hidden" name="Id" value="108">
<td height="35" colspan="2"> <input type="submit" name="Submit" value="提交" class="input">

<input type="reset" name="Submit" value="重置" class="input"> </td>
</tr>
</form>
</table>
</tr>
</table>
<table width="100%" height="28" border="0" cellpadding="0" cellspacing="0" class="HeaderTdStyle">
<tr>
<td>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td align="right">Design By <a href="mailto:[email protected]">ZXKJ</a></td>

</tr>
</table></td>
</tr>
</table>

處理頁面News_save.asp代碼:
<!--#include file="conn.asp"-->
<%
if Request.QueryString("action")="Add" then
set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from News"
rs.open sql,conn,1,3
If request.form("Title")="" Then
Response.Write("<script language=""JavaScript"">alert(""錯誤:您沒輸入標題,請返回檢查!!"");history.go(-1);</script>")
response.end
end if
If request.form("content")="" Then
Response.Write("<script language=""JavaScript"">alert(""錯誤:您沒輸入新聞內容,請返回檢查!!"");history.go(-1);</script>")
response.end
end if
If request.form("user")="" Then
Response.Write("<script language=""JavaScript"">alert(""錯誤:您沒輸入發布人,請返回檢查!!"");history.go(-1);</script>")
response.end
end if

rs.addnew
rs("Title")=request.form("Title")
rs("Content")=request.form("content")
rs("BigClassName")=request.form("BigClassName")
rs("SmallClassName")=request.form("SmallClassName")
rs("FirstImageName")=request.form("DefaultPicUrl")
rs("User")=request.form("user")
rs("AddDate")=request.form("AddDate")
rs("Ok")=request.form("Ok")
rs.update
rs.close
set rs=nothing
response.Redirect "News_Manage.asp"
end if
%>

⑺ ckeditor在ASP中如何配置上傳圖片,朋友可否幫助解決!

可以使用CKFinder。
js代碼中需要引入:<script type="text/javascript" src="../editor/ckfinder/ckfinder.js"></script>
並加入:CKFinder.setupCKEditor( oCKeditor, '../editor/ckfinder/' ) ;
具體上傳配置CKFinder的目錄裡面config.asp文件裡面有說明。

⑻ asp.net+ckeidtor+ckfinder如何限制上傳圖片的大小

CKeditor config.ascx裡面

Images.MaxWidth = 1600;
Images.MaxHeight = 1200;
Images.Quality = 80;

⑼ 誰能告訴我怎樣在ASP CKEditor 中實現上傳圖片功能

1、項目先新建Lbrary文件夾跟js文件夾(js小寫)並在js文件夾下,在簡歷ckeditor和ckfinder文件夾,壓縮包找到其中/bin/Debug下的CKEditor.NET.dll考到新建的文件夾下,如後在引用中右鍵添加對剛才的CKEditor.NET.dll的引用,如圖:

熱點內容
linuxip設置命令 發布:2024-05-21 22:52:56 瀏覽:851
aspnetfile上傳 發布:2024-05-21 22:28:58 瀏覽:671
華為nm存儲卡卡刷 發布:2024-05-21 22:25:23 瀏覽:601
sql注入過程 發布:2024-05-21 22:20:07 瀏覽:949
c並行編程 發布:2024-05-21 22:10:00 瀏覽:150
愛比較伺服器怎麼開 發布:2024-05-21 22:00:42 瀏覽:668
java代碼格式 發布:2024-05-21 21:56:09 瀏覽:36
吃奶演算法 發布:2024-05-21 21:51:07 瀏覽:143
壓縮機熱泵 發布:2024-05-21 21:51:04 瀏覽:926
安卓網頁源碼在哪裡 發布:2024-05-21 21:46:56 瀏覽:895