Cannot upload images using FCK editor php- DETAILED SOLUTION

Ask community to help.

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
nyamanza
TestLink user
Posts: 5
Joined: Wed Apr 25, 2007 5:57 am

Cannot upload images using FCK editor php- DETAILED SOLUTION

Post by nyamanza »

Hi All,

Please, PLEASE help! I must be doing something stupid but I have no idea what. I might just do a write up for noobies once I know what to do.

OK --
Win2K
MYSQL Ver 5.0.3.37
PHP 5.2.1
Apache 2.2.4
TL - 1.6.3 and 1.7RC2

The Problem
--------------
I can use the FCKeditor to add and format text, BUT I cannot upload or attach images using the image button.

Research
----------
I have searched these forums and the wiki of the fckeditor and changed the relevant config files to no avail. I wonder if there is a step by step for noobs to make this easy? I am happy to create one if needed (once I get mine working!)

So What HAVE I tried?
-------------------------
-All new installs
-Edited testlink\third_party\fckeditor\fckconfig.js and uncommented the line;
FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code

in the same file I changed the following from reading 'asp' to 'php'

var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php

-Edited testlink\third_party\fckeditor\editor\filemanager\browser\default\connectors\php\config.php
changed the line below from false to true

$Config['Enabled'] = true ;

also tried setting the below path (it is currently as below)

$Config['UserFilesAbsolutePath'] = '' ;

-did the same as above for

\testlink\third_party\fckeditor\editor\filemanager\upload\php\config.php

-created the folders
\testlink\userfiles\file
\testlink\userfiles\flash
\testlink\userfiles\image
\testlink\userfiles\media

for all the above folders I tried setting the security to 'everyone' with full control (just to get it working) to no avail :(

Further Information
---------------------
Could someone clarify which slashes '/' to use for the paths when referring to the userfiles (or any other folders for that matter) as I wonder if I'm doing something wrong here?

The Solution?
---------------
Can you help?

Thanks in advance for any help you can give!
nyamanza
TestLink user
Posts: 5
Joined: Wed Apr 25, 2007 5:57 am

The Solution

Post by nyamanza »

Hi All,

The solution is quite involved but for anyone else who encounters this, this should be very useful. The problem rears it's head, in different ways, but the basic gist of the issue is in the title 'cannot upload images'.

This solution assumes you are running apache with php and testlink 1.7rc2.

Configure FCKEditor
Edit testlink\third_party\fckeditor\fckconfig.js

Uncomment the line

Code: Select all

\\ FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code 
to read

Code: Select all

FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code 
Change the folllowing lines from;

Code: Select all

var _FileBrowserLanguage = 'asp' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'asp' ; // asp | aspx | cfm | lasso | p
hp

to;

Code: Select all

var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php 
Edit testlink\third_party\fckeditor\editor\filemanager\browser\default\connectors\php\config.php

Change

Code: Select all

$Config['Enabled'] = false ; 
to

Code: Select all

$Config['Enabled'] = true ;


Edit
\testlink\third_party\fckeditor\editor\filemanager\upload\php\config.php

Change

Code: Select all

$Config['Enabled'] = false ; 
to

Code: Select all

$Config['Enabled'] = true ; 
and

Code: Select all

$Config['UserFilesPath'] = '/userfiles/' ;
to

Code: Select all

$Config['UserFilesPath'] = '/userfiles/images/' ;
Edit php.ini (in your apache\bin and your php folder)

Change

Code: Select all

upload_tmp_dir = "C:\xampp\tmp"
to

Code: Select all

upload_tmp_dir = "C:\xampp\testlink\userfiles"
Edit

Code: Select all

testlink\third_party\fckeditor\editor\filemanager\upload\php\upload.php
Change (line 93)

Code: Select all

$sServerDir .= $sType . '/' ;
to

Code: Select all

$sServerDir .= strtolower($sType) . '/' ;
Change (line119)

Code: Select all

$sFileUrl = $Config["UserFilesPath"] . $sType . '/' . $sFileName ;
to

Code: Select all

$sFileUrl = $Config["UserFilesPath"] . strtolower($sType) . '/' . $sFileName;
Create the folders;
  • htdocs\userfiles
    htdocs\userfiles\file
    htdocs\userfiles\images
    htdocs\userfiles\flash
    htdocs\userfiles\media
Once I had done all of the above I was able to upload images and files.
mspaul
TestLink user
Posts: 10
Joined: Fri May 18, 2007 6:05 pm

Post by mspaul »

I tried the steps above, but could not get the image feature to work.

What is htdocs? Is it the www folder.

I have a testlink folder under www folder, where should I place the userfiles folder at?

Any other possible sources of error?

Thanks!
mspaul
TestLink user
Posts: 10
Joined: Fri May 18, 2007 6:05 pm

Post by mspaul »

Got it working :D

It was a typing mistake.

Good solution. Thanks!
havlatm
Member of TestLink Community
Posts: 940
Joined: Mon Oct 31, 2005 1:24 am
Location: Czech

Post by havlatm »

Thank you too. I moved your solution into HowTo section:
http://www.teamst.org/index.php?option= ... 3&Itemid=2
hellofawedge
Advanced user
Posts: 17
Joined: Mon Sep 17, 2007 5:17 am

Post by hellofawedge »

One more thing to note, once all those changes are made (nice work! :D ), I've had to use IE7 with TL 1.7.0 as FireFox (2.0.0.9) causes XML errors when attempting to browse for images to upload.

Works fine with IE7.

Cheers
sonychen59
TestLink user
Posts: 4
Joined: Mon Nov 12, 2007 12:39 pm

Cannot upload file when my Testlink is running in VirtualBox

Post by sonychen59 »

Hi! All,

I cannot upload files when my Testlink is running within the guest OS of the VirtualBox. (Follow the instructions described above, the Testlink works fine on Host.) The following is the details:

Host OS: RHEL AS 4.0
Guest OS: RHEL AS 4.0, Fedora 7, CentOS 5

The network between Host and Guest has been established by bridge.
There are two NICs on Host.
One is "10.0.3.15" for internet, another is for intranet. The iptables has been configured for NAT.

The Guest has a virtual NIC, vbox0, cooperates with the intranet NIC of Host's. And both of them work as bridge, named br0, whose IP address is "172.16.0.1".

I don't know where is the crux of this problem. Is it the problem of network (iptables), Testlink or VirtualBox?

Would you clue me in about this? :roll: Thanks! :wink:
sonychen59
TestLink user
Posts: 4
Joined: Mon Nov 12, 2007 12:39 pm

Re: Cannot upload file when my Testlink is running in Virtua

Post by sonychen59 »

sonychen59 wrote:Hi! All,

I cannot upload files when my Testlink is running within the guest OS of the VirtualBox. (Follow the instructions described above, the Testlink works fine on Host.) The following is the details:

Host OS: RHEL AS 4.0
Guest OS: RHEL AS 4.0, Fedora 7, CentOS 5

The network between Host and Guest has been established by bridge.
There are two NICs on Host.
One is "10.0.3.15" for internet, another is for intranet. The iptables has been configured for NAT.

The Guest has a virtual NIC, vbox0, cooperates with the intranet NIC of Host's. And both of them work as bridge, named br0, whose IP address is "172.16.0.1".

I don't know where is the crux of this problem. Is it the problem of network (iptables), Testlink or VirtualBox?

Would you clue me in about this? :roll: Thanks! :wink:

More information:
I upload the files from the Guest OS that the Testlink, Apache, MySQL and PHP packages have been installed.
sonychen59
TestLink user
Posts: 4
Joined: Mon Nov 12, 2007 12:39 pm

Re: Cannot upload file when my Testlink is running in Virtua

Post by sonychen59 »

Hi! All,

I think this problem should be removed by this subject.

I've tried to modify the iptables, the upload mechanism works fine.

Anyway, I've learned much from this forum. TKS! :lol:
x81kilo
TestLink user
Posts: 1
Joined: Wed Feb 13, 2008 7:36 pm

Just confirmed what hellofawedge said

Post by x81kilo »

hellofawedge was right on, the code changes work but only IE7 is seeing no issues with upload. Firefox 2.0.0.11 is what i am using as alternate browser and this is giving errors.

Can we request future versions of this be fixed somehow before deploying TestLink?

or is testlink using an older version of FCKeditor ?

And thanks to the one that helped with the code fixes.
Frosty
TestLink user
Posts: 1
Joined: Fri Mar 14, 2008 11:32 am

Post by Frosty »

Hi,

Just to say that the following action is useless :
Edit php.ini (in your apache\bin and your php folder)

Change

Code: Select all

upload_tmp_dir = "C:\xampp\tmp" 
to

Code: Select all

upload_tmp_dir = "C:\xampp\testlink\userfiles"
Please update the doc accordingly at http://www.teamst.org/index.php?option= ... 3&Itemid=2.
eric
TestLink user
Posts: 1
Joined: Thu Mar 20, 2008 5:52 pm

Post by eric »

I've followed the above instructions to the letter, and I'm still having trouble. When I click to add an image, go to the Upload tab of the popup window, select an image and click "Send it to the Server", I get a JS box saying "Your file has successfully been uploaded". When I click ok, I see in the Preview pane a broken image link. If I click the Browse Server button, I get another popup window with blank columns. If I try to Create New Folder, I'm told "You have no permission to create the folder".

Any suggestions?

Here's a typical script I'll run to normalize all the files/folders/ownership:

Code: Select all

chown -R apache:apache *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
All files are owned by apache, all directories are 755, all files are 644. Is this how it should be?

By the way, my testlink install is not in my web root, but in a testlink subfolder.
ddai
TestLink user
Posts: 5
Joined: Tue May 06, 2008 6:10 am
Location: Shanghai, China

Printed MS Word Test Plan/Cases lost image

Post by ddai »

I followed your instructions and it works. And Print Test Plan/Cases can work correctly with HTML export.

But when I use MS Word export, all the images lost (show blank frame where should be image).

How can I resolve it?

Thank you,
DDai
havlatm
Member of TestLink Community
Posts: 940
Joined: Mon Oct 31, 2005 1:24 am
Location: Czech

Post by havlatm »

I updated article as Frosty recommend.
Eric, try temporary set it to chmod 777 ... to be sure that problem is not in permissions
Answer for ddai could be find in appropriate topic.
bfanyuk@kirkazan.ru
TestLink user
Posts: 6
Joined: Tue Aug 18, 2009 8:31 am

Post by bfanyuk@kirkazan.ru »

I made everything as said here.
But I still see alert with the following message:
The server didn't send back a proper XML response. Please contact your system administrator.

XML request error: OK (200)

Requested URL:
http://192.168.4.25/testlink/third_part ... Folder=%2F
As I understand connector.asp means that testlink still tries to use ASP. Please, help!
Post Reply