`
ttf177
  • 浏览: 24592 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

Delete application name in URL after uploading with Fckeditor

阅读更多
Fckeditor is an open source online html editor. In my project I use it in the article-add page. The usage is very easy, all you need to do is put the "fckeditor" folder under Web-Root directory and write some lines as below:
 <script>
           var editor = new FCKeditor('content');
           editor.BasePath='/myproject/fckeditor/';
           editor.ToolbarSet='UserToolbar';
           editor.Create();
</script>
 
Of course there are other attributes with "editor", you can set them according to you quirements. What I want to mention is the upload function. When we use the upload function, take "image upload" for example, after uploading the image, generally, which we choose from our local PC, the frame change to "Attribute" window automatically, and the URL for the image we just uploaded like this: /myproject/userfiles/image/myimage.jpg. It is OK when I test the function on my own computer, but something wrong happens when I do the same thing on the Internet. Because on my computer I use the IP to connect the Web-application but on the Internet I use the domain name. For example, the domain name is http://my.myforge.org and it is binding to an IP 192.168.0.1:8080/myproject. After uploading the image, I get the URL as follows:/myproject/myproject/userfiles/image/myimage.jpg. It is easy to find that the "myproject" is duplicated and the image can't be linked exactly to the server. The domain binding to the IP can't be changed, so I try to alter the URL the "uploading function" returned.
 
After  study on the source code, I solve the problem at last and it is only a matter of one centence.Take "image upload" for instance, first open fck_image.js under fckeditor/editor/dialog/fck_image. You could find a function OnUploadCompleted(), near the bottom line of the function you could find SetUrl(fileUrl);, then I change it to: fileUrl = fileUrl.substring(10,fileUrl.length); SetUrl( fileUrl ) ;.The result of this chang is the first /myproject will be deleted before it is returned to the "Attribute" window. The number 10 is mutative according to you application name.
分享到:
评论

相关推荐

    Laravel Application Development Blueprints

    With the recently released 4th Version, Laravel became even better in numerous ways. Within this book, we will help you learn about both the old and new features of Laravel while developing various ...

    file-uploading-with-php-and-mysql.rar_file upload_truth5fw

    标题中的“file-uploading-with-php-and-mysql.rar_file upload_truth5fw”暗示了这是一个关于使用PHP和MySQL实现文件上传功能的教程或代码示例。PHP是一种广泛使用的服务器端脚本语言,尤其适合Web开发,而MySQL是...

    Uploading and Downloading Files in Web Dynpro Java

    response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\""); OutputStream out = response.getOutputStream(); ...

    EurekaLog_7.5.0.0_Enterprise

    23)..Added: Support for uploading multiple files in JIRA 24)..Added: EResLeaks improvements (new funcs: ResourceAdd, ResourceDelete, ResourceName; support for realloc-like functions) 25)..Fixed: Added...

    化妆品培训材料.pptx.baiduyun.uploading.cfg

    化妆品培训材料.pptx.baiduyun.uploading.cfg

    Uploading Desktop

    Uploading Desktop

    [App] 网络应用开发 学习手册 (英文版)

    - Share your application by uploading it to the cloud with CloudFoundry - Get basic tips for writing maintainable code on both client and server ☆ 出版信息:☆ [作者信息] Semmy Purewal [出版机构] ...

    phpmaker610官方安装版

    Optional Grid-Add, Grid-Edit, Inline-Add, Inline-Copy, Inline-Delete, Inline-Edit right in the List page Optional confirmation page before insering or updating record Pagers in List/View page Fully ...

    化妆品工艺.pptx.baiduyun.uploading.cfg

    化妆品工艺.pptx.baiduyun.uploading.cfg

    Springboot通过MinIO进行文件操作代码

    throw new RuntimeException("Error uploading file", e); } } public OutputStream downloadFile(String objectName) throws IOException, MinioException { return minioClient.getObject(bucketName, ...

    Ext.ux.UploadDialog

    url - the url where to post uploaded files. base_params - additional post params (default to {}). permitted_extensions - array of file extensions which are permitted to upload (default to []). ...

    TICQClient Version

    const URL, Description: String) procedure for sending URLs[+] Added SetSelfInfoGeneral, SetSelfInfoMore, SetSelfInfoAbout procedures for uploading the self info[-] Fixed SearchByName procedure, now ...

    uploading-file-in-sails:在 Sails 中上传文件

    在 Sails 中上传文件Sails 使用skipper上传文件如何使用此代码git clone https://github.com/maangalabs/uploading-file-in-sails.gitcd uploading-file-in-sailssudo npm installsails lift转到...

    Python Cookbook, 2nd Edition

    Ensuring a Name Is Defined in a Given Module Chapter 5. Searching and Sorting Introduction Recipe 5.1. Sorting a Dictionary Recipe 5.2. Sorting a List of Strings Case-Insensitively Recipe ...

    AutoUpgrader_XE7

    Package contains two bonus components from Advanced Application Controls pack: auHTTP (WinInet-based HTTP client which also supports file uploading via HTTP, (introduced in RFC1867), Internet ...

Global site tag (gtag.js) - Google Analytics