On Sat, 5 May 2001, Yasuo Ohgaki wrote:
> Could we take a look at your code?
Of course. Shall I send whole application or this snippet will
do?
// How the form is specified
<form enctype="multipart/form-data" action="edit_item.php4" method=post>
<input
type="hidden"
name="MAX_FILE_SIZE"
value="<?php echo $metaItem->getMaxImageSize(); ?>"
>
<input type="hidden" name="action" value="<?php echo $action; ?>">
// Some other form elements...
<input name="userfile" type="file">
// Some other form elements...
</form>
// After the file is uploaded
if ( is_uploaded_file( $userfile ) ) {
$extension = strrchr( $userfile_name, '.' );
$item->setImageType( $extension );
$image = $metaItem->getImageDir().'/'.$item->getId().$extension;
move_uploaded_file( $userfile, $image );
chmod( $image, 0400 ); // I've tried without this at first
}
// Class Item
function getId()
{
return $this->id;
}
function setImageType( $image_type )
{
$id = $this->id;
if ( $this->image_type != $image_type ) {
$res = db_exec(
"update ite_items
set ite_image_type = '$image_type'
where ite_id = $id"
);
}
}
// Class MetaItem
function getImageDir()
{
global $imagedir; // Set in configuration file
return $imagedir;
}
function getMaxImageSize()
{
global $ITEM_MAX_IMAGE_SIZE; // Set in configuration file
return $ITEM_MAX_IMAGE_SIZE;
}
I can't find an error by myself. Please help if you can. Thank
you.
Regards,
Andrzej
--
http://kokosz.horyzont.net
http://www.earthdawn.pl
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]