You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CKEditor升级后上传脚本Query String截断及CKEditorFuncNum填充问题

CKEditor 4.9 Upgrade: Fixing Image Upload & Query String Truncation Issues

Hey there, let's break down the two issues you're facing after upgrading from CKEditor 4.7.3 to 4.9, and walk through practical fixes for each:

1. Restoring Image Upload Functionality (CKEditorFuncNum Not Populating)

Starting with CKEditor 4.9, the file browser/upload tools were moved into a dedicated filebrowser plugin—this wasn't required in 4.7.3 because those features were part of the core. To ensure the CKEditorFuncNum parameter gets correctly appended to your upload request URL, you need to explicitly enable this plugin in your CKEditor config:

// Add this line to your CKEditor configuration
config.extraPlugins = 'filebrowser';

If you already have other plugins enabled in extraPlugins, just append it with a comma:

config.extraPlugins = 'your-existing-plugin,filebrowser';

This ensures CKEditor injects the necessary CKEditorFuncNum value into the upload URL, which is critical for the upload callback to work (it tells CKEditor which editor instance to send the uploaded image back to).

2. Fixing Query String Truncation in PHP Upload Script

A truncated query string typically comes from one of these common issues—let's go through each solution:

a. Adjust PHP's max_input_vars Setting

PHP has a default limit on the number of input variables it accepts (max_input_vars, default is 1000). If your query string has more parameters than this limit, PHP will truncate the excess. To fix this:

  • Edit your php.ini file and set:
    max_input_vars = 3000
    
  • If you don't have access to php.ini, add this line at the top of your PHP upload script:
    ini_set('max_input_vars', 3000);
    

b. Tweak Web Server Limits

Web servers like Apache or Nginx enforce limits on request URL length. For Apache:

  • Check your Apache config (or .htaccess) for LimitRequestLine and LimitRequestFieldSize—increase their values if needed:
    LimitRequestLine 10000
    LimitRequestFieldSize 10000
    

For Nginx, adjust these settings in your server block:

client_max_body_size 20M;
large_client_header_buffers 4 16k;

c. Let CKEditor Handle URL Construction

Don't manually build the upload URL with parameters like CKEditorFuncNum—let CKEditor handle this automatically. Use the official filebrowserUploadUrl config setting instead of customizing the form action:

// Correct way to set your upload endpoint
config.filebrowserUploadUrl = '/xxxx/uploader.php';

CKEditor will automatically append CKEditor, CKEditorFuncNum, and other required parameters, avoiding incorrect escaping (like the & you saw in your action URL, which can cause parsing errors).

d. Verify Parameter Retrieval in PHP

Make sure your upload script fetches CKEditorFuncNum from the query string (it's passed via GET, even though the form uses POST). Avoid relying on $_REQUEST (which can mix GET/POST values) and use $_GET directly:

$funcNum = isset($_GET['CKEditorFuncNum']) ? (int)$_GET['CKEditorFuncNum'] : 0;

内容的提问来源于stack exchange,提问作者leemon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:45:04