I've installed opencart v0.6 on my local desktop running apache2, php5 and mysql4. All seems to be working ok but I am having problems uploading image files. When I want to add a new image, I specify the name/title and then browse to the image file and click 'save'. Unfortunately, nothing gets added. I've tracked the code and found the problem to be in admin/plugin/image.php on line 47. It appears move_uploaded_file() seems to fail and hence nothing is added. I've tried to debug what's going on by adding the following:
Code: Select all
if ($_POST['task'] == 'insert') {
?>$_FILES: <?=print_r($_FILES)?>.<?
?>$_POST: <?=print_r($_POST)?>.<?
?>is_uploaded_file()?: '<?=is_uploaded_file($_FILES['image']['tmp_name'])?>'.<?
?>moving uploaded file ... from: '<?=$_FILES['image']['tmp_name']?>' to '<?=DIR_IMAGE . basename($_FILES['image']['name'])?>'.<?
if ($x = move_uploaded_file($_FILES['image']['tmp_name'], DIR_IMAGE . basename($_FILES['image']['name']))) { ...
Code: Select all
$_FILES: Array
(
[image] => Array
(
[name] => 73.orig.jpg
[type] => image/jpeg
[tmp_name] => E:/php-5.1.4/tmp/php29.tmp
[error] => 0
[size] => 184506
)
)
1.$_POST: Array
(
[title] => Array
(
[1] => 022FM
)
[task] => insert
)
1.is_uploaded_file()?: ''.moving uploaded file ... from: 'E:/php-5.1.4/tmp/php29.tmp' to 'E:/Projects/opencart06/image/73.orig.jpg'.x: ''.<br />
<b>Warning</b>: Cannot modify header information - headers already sent by (output started at E:\Projects\opencart06\admin\plugin\image.php:47) in <b>E:\Projects\opencart06\admin\plugin\image.php</b> on line <b>65</b><br />
error_reporting is set to E_ALL and nothing is output.
I'm guessing this is some kind of environment problem because I've got opencart installed on a separate web server and image uploads work fine. However, I have another site I have developed running off the same web server that handles file uploads fine!
If anyone has an answer or had a similar problem, please let me know. I'm going to try continue to solve it so if I find an answer before anyone else, I'll let you know.
Thanks,
Martyn.