【问题标题】:FileManager For TinyMCE not getting variableTinyMCE 的 FileManager 没有变量
【发布时间】:2015-06-17 16:11:54
【问题描述】:

我使用 TinyMCE 作为所见即所得的编辑器。 它工作得很好,除了图像上传目录。我希望每个用户在 images 目录中都有自己的目录,但我无法让它工作。

我在 URL 中传递用户 ID,并尝试添加代码以从定义目录的 config.php 文件中的 URL 获取它,但 $user_id 值仍然为空。

任何帮助都会很棒。

网址:

http://mydomain.co.za/index.php?user_id=1

代码:

<?php
$user_id= htmlspecialchars($_GET["user_id"]);

// The URL that points to the upload folder on your site. 
// Can be a relative or full URL (include the protocol and domain)
$imageURL = 'http://mydomain.co.za/images/'.$user_id;
// Full upload system path. Make sure you have write permissions to this folder
$uploadPath = '/home/username/public_html/editor/images/'.$user_id;
//We create the directory if it does not exist - you can remove this if you consider it a security risk
if(!is_dir($uploadPath)) {
    mkdir($uploadPath,0755,true);
}

//Create thumb directory if doesn't exist
if(!is_dir($uploadPath . 'thumbnail')) {
    mkdir($uploadPath . 'thumbnail',0755,true);
}

//Allowed extenstions
$allowedExtensions = array('jpg','gif','jpeg','bmp','tif','png'); 
//Maximum upload limit
$sizeLimit = 2 * 1024 * 1024;

function isAuth() {
    //Perform your own authorization to make sure user is allowed to upload
    return true;
}

可能是因为它不在主php文件中吗?
或者我可以从 URL 中获取变量吗?

他们在 Instructions 上建议我添加 $userId = Auth::getId(); 但 id 返回一个空值。另外,我不知道该命令正在执行什么。

请注意: 文件管理由TinyMCE Image Uploader & Manager完成

更新:

通过添加$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; echo $actual_link;,我注意到在$_GET 命令运行时,URL 已更改为http://mydomain.co.za/tinymce/plugins/lioniteimages/connector/php/gallery.php,但在浏览器的URL 栏中,URL 仍然与变量相同。

有没有办法访问那个 URL 而不是我得到的那个?

【问题讨论】:

  • 这个描述看起来很脱节。无法理解你的例子。图片是如何通过POST上传的?页面如何从您的预期网址到达您遇到问题的网址?
  • @Twisty 对不起,我无法理解自己发生了什么。我研究得越多,我就越困惑……但我找到了解决方案。还是谢谢你:)

标签: php html tinymce


【解决方案1】:

我找到了解决办法。

很简单,刚刚创建了一个会话,问题就解决了。

我能够从会话中获取变量。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多