FCKeditor allows different users to upload images to their respective folders.

Source: Internet
Author: User

FCKeditor allows different users to upload images to their respective folders.

I spent more than a week doing this. I checked a lot of information on the Internet, that is, I did not complete the steps and finally realized it myself. Although it was slightly incomplete, but it can be used.
1. Add attributes in the background of the page using FCKeditor:
String simagebrowserurl = "/Xiaoqing/FCKeditor/Editor/filemanager/Browser/default/browser.html?
Type = Image & connector =.../connectors/aspx/connector. aspx & userid = ";
2. Add the oninit = "fckcontent_init" event to the FCKeditor on the page.
Event content:
Protected void fckcontent_init (Object sender, eventargs E)
{
Id = request. querystring ["ID"];
If (session ["currentuser"]! = NULL)
{
Usermodel = session ["currentuser"] As maticsoft. model. users;
Simagebrowserurl + = usermodel. usid. tostring ();
}
Else
{
Response. Write ("<SCRIPT> alert ('the current login user has expired, please log on again '); location =' ../index. aspx '</SCRIPT> ");
}
Fckcontent. imagebrowserurl = simagebrowserurl;
}
3. In/website (your website)/FCKeditor/Editor/filemanager/connectors/aspx/connector. aspx, add
<SCRIPT runat = "server" Language = "C #">
Protected override void oninit (eventargs E)
{
If (request. querystring ["userid"] = NULL)
{
Session ["FCKeditor: userfilespath"] = "~ /Userfiles/"; // set the default value
}
Else
{
Session ["FCKeditor: userfilespath"] = "~ /Users/images/"+ request. querystring [" userid "] + "/";
}
}
</SCRIPT>
4. Modify/website (your website)/FCKeditor/Editor/filemanager/Browser/default/browser.html using a method of about 63 rows
Oconnector. sendcommand = function (command, Params, callbackfunction)
{
VaR Surl = This. connectorurl + 'COMMAND = '+ command;
Surl + = '& type =' + this. resourcetype;
Surl + = '& CurrentFolder =' + encodeuricomponent (this. CurrentFolder );

If (Params) Surl + = '&' + Params;

// Add a random salt to avoid getting a cached version of the Command Execution
Surl + = '& UUID =' + new date (). gettime ();
// LHY modify begin
VaR userid = geturlparam ('userid ');
If (userid. length> 0)
Surl + = '& userid =' + userid;
// LHY modify end
VaR oxml = new fckxml ();

If (callbackfunction)
Oxml. loadurl (Surl, callbackfunction); // asynchronous load.
Else
Return oxml. loadurl (Surl );

Return NULL;
}
Method
// LHY modify begin
VaR userid = geturlparam ('userid ');
If (userid. length> 0)
Surl + = '& userid =' + userid;
// LHY modify end
Is the added content
5. Remove the link and advanced of 'image attribute' in 'inserted image', and keep and upload images.
Specific modification:/website (your website)/FCKeditor/Editor/dialog/fck_image/fck_image.js
Note:
// ##### Dialog tabs

// Set the dialog tabs.
Dialog. addtab ('info', fcklang. dlgimginfotab );

Note // If (! Bimagebutton &&! Fckconfig. imagedlghidelink)
// Dialog. addtab ('link', fcklang. dlgimglinktab );

If (fckconfig. imageupload)
Dialog. addtab ('upload', fcklang. dlglnkupload );

Note // If (! Fckconfig. imagedlghideadvanced)
// Dialog. addtab ('advanced ', fcklang. dlgadvancedtag );

// Function called when a dialog tag is selected.
6. Remove the "Browse server" button in the image.
/Website (your website)/FCKeditor/Editor/dialog/fck_image.html
About 49 rows,
Note
<! --
<Input id = "btnbrowse" onclick = "browseserver ();"
Type = "button" value = "Browse server" fcklang = "dlgbtnbrowseserver"/>
-->

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.