Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#13 2008-03-29 21:34:33
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Problems uploading images or files, creating thumbnails
I assume you meant to paste it right after the opening <?php
?
That doesn’t bring up the images tab, but produces a blank page with the error message:
Parse error: syntax error, unexpected T_ECHO in /srv/vefir/fyrirt/landslag.is/www/textpattern/include/txp_image.php on line 6
Offline
Re: Problems uploading images or files, creating thumbnails
Missing semicolons:
var_dump($_FILES);
if ($_FILES)
{
$f = $_FILES['thefile']['name'];
echo ' is_uploaded_file: ';
var_dump(is_uploaded_file($f));
echo ' tempnam: ';
$newfile = tempnam($GLOBALS['tempdir'], 'txp_');
var_dump($newfile);
echo ' move uploaded file: ';
var_dump(move_uploaded_file($f, $newfile));
}
Last edited by jm (2008-03-29 22:26:04)
Offline
#15 2008-03-29 22:07:47
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Problems uploading images or files, creating thumbnails
jm wrote:
Missing semicolon:
Tried that, but still the same error.
Offline
Re: Problems uploading images or files, creating thumbnails
Oops, there were two missing semicolons. Updated the code.
Offline
#17 2008-03-29 22:54:29
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Problems uploading images or files, creating thumbnails
Thanks for your help, that did the trick and here are the results:
array(1) {
["thefile"]=>
array(5) {
["name"]=>
string(11) "thrainn.jpg"
["type"]=>
string(10) "image/jpeg"
["tmp_name"]=>
string(14) "/tmp/phpWZ24Or"
["error"]=>
int(0)
["size"]=>
int(28274)
}
}
is_uploaded_file: bool(false)
tempnam: <br />
<b>Warning</b>: tempnam() [<a href='function.tempnam'>function.tempnam</a>]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/srv/:/tmp/) in <b>/srv/vefir/fyrirt/landslag.is/www/textpattern/include/txp_image.php</b> on line <b>9</b><br />
bool(false)
move uploaded file: bool(false)
What does that mean?
Offline
#18 2008-03-30 01:16:52
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Problems uploading images or files, creating thumbnails
Try setting the tmp folder to the the one inside the textpattern directory.
Offline
Re: Problems uploading images or files, creating thumbnails
This is weird. Your diagnostics show:
open_basedir: /srv/:/tmp/
Temporary directory path: /tmp
Yet you get the error:
open_basedir restriction in effect.
File(/tmp) is not within the allowed path(s): (/srv/:/tmp/)
Looks like that trailing slash is important, so setting the temp directory to /tmp/ should work as well.
Anyhow, error handling needs some improvements, because many of the errors in get_uploaded_file go unnoticed at the moment.
PS. yes, the patch should be applied as you describe it.
Offline
#20 2008-03-30 13:20:27
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Problems uploading images or files, creating thumbnails
Mary & Ruud,
relief – it’s finally working!
The temp directory was set to the one in the Txp folder, but adding the trailing slash did the trick. Since I still have the debug code in txp_image.php I now get this output (the image uploads fine):
array(1) {
["thefile"]=>
array(5) {
["name"]=>
string(10) "sigrun.jpg"
["type"]=>
string(10) "image/jpeg"
["tmp_name"]=>
string(14) "/tmp/phpcDxcdQ"
["error"]=>
int(0)
["size"]=>
int(22423)
}
}
is_uploaded_file: bool(false)
tempnam: string(15) "/tmp/txp_hGBWrH"
move uploaded file: bool(false)
Does that look OK?
Thank you so much for all your kind help – you’ve saved the day and the ones to come!
Last edited by masa (2008-03-30 13:21:56)
Offline
Re: Problems uploading images or files, creating thumbnails
that’s okay, you can remove the debug code.
Last edited by ruud (2008-03-30 14:01:24)
Offline
#22 2008-03-30 20:33:30
- masa
- Member
- From: North Wales, UK
- Registered: 2005-11-25
- Posts: 1,095
Re: Problems uploading images or files, creating thumbnails
Thanks again everyone for the help! :-)
I implemented Ruud’s patch and it works great.
(This thread can be archived.)
Offline