Enable the image upload function of the FCKeditor and solve the image path problem.

Source: Internet
Author: User
Tags file upload

1. Open the admin/editor/fckconfig. js file in the website background editor.

Find the FCKConfig. ImageUpload = false sentence and change false to true.

FCKConfig. ImageBrowser = false; here, change false to true.

2. Check whether the filemanager folder in the admin/editor directory exists. If not, download a fck editor of Version 2.6.3 or later and copy the filemanager folder. Of course, this is ASP, so folders in other languages such as PHP can be deleted.

3. Next, set the file upload path. Open the config. asp file in the admin/editor/filemanager/connectors/asp folder and perform the following settings.

ConfigIsEnabled = True: whether to enable the upload function

ConfigUserFilesPath = "../uploads/" file Upload Directory, relative to this folder

ConfigUserFilesPath = "../uploads/". If this is the case, I found two problems at last.

 

A. configUserFilesPath = ".. /.. /.. /.. /.. /uploads/". Although images can be uploaded, there is a problem with inserting the image path in the editor, so I tried it many times and finally changed it to ConfigUserFilesPath = "/uploads. If your website is stored in a lower-level folder, you can set ConfigUserFilesPath = "folder name/uploads /".

B. As for the second question, it seems strange to me that two slashes may appear in the image path of the FCKeditor. Although the image can also be displayed, it seems uncomfortable. Open the io. asp file in the admin/editor/filemanager/connectors/asp folder:

Function CombinePaths (sBasePath, sFolder)

CombinePaths = RemoveFromEnd (sBasePath, "/") & "/" & RemoveFromStart (sFolder ,"/")

End function

Change

Function CombinePaths (sBasePath, sFolder)

SFolder = replace (sFolder ,"","/")

CombinePaths = RemoveFromEnd (sBasePath, "/") & "/" & RemoveFromStart (sFolder ,"/")

End function

4. Set the automatic rename of the uploaded image. Open the commands. asp file in the admin/editor/filemanager/connectors/asp folder.

Add the following statement to the file:

Dim rannum

Dim dtnow

Dim getnewfilename

Dtnow = now ()

Randomize

Rannum = int (90 * rnd) + 10

Getnewfilename = year (dtnow) & right ("0" & month (dtnow), 2) & right ("0" & day (dtnow), 2) & right ("0" & hour (dtnow), 2) & right ("0" "& minute (dtnow), 2) & right ("0" & second (dtnow), 2) & rannum

And set

SFileName = ouploader. file ("newfile") name

Change

SFileName = getnewfilename & "." & split (ouploader. file ("newfile"). name, ".") (1)
Effect .:

OK is the information returned by the server. It is not included in ckeditor.



Finally, it would be perfect to call the onChange method of Info directly after the upload is successful. But I cannot call this method all the time...

After that, you can test it yourself. You can also modify some methods in image. js, for example, onOK --> indicates the method that will be triggered when you click OK.

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.