Re: Vanishing files.

From: Date: Sat, 05 May 2001 19:08:14 +0000
Subject: Re: Vanishing files.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51555@lists.php.net to get a copy of this message
Since I don't use "register_globals=on", this might not be the problem what you have. If will have following data in $HTTP_POST_FILES ============================= $HTTP_POST_FILES Array ( [userfile] => Array ( [name] => Array ( [0] => README.i18n_eng [1] => ) [type] => Array ( [0] => text/plain [1] => application/octet-stream ) [tmp_name] => Array ( [0] => /home/httpd/upload_tmp/phpeVlhZN [1] => none ) [size] => Array ( [0] => 23048 [1] => 0 ) ) ) ========================== Your code is using $userfile as scaler value. Could it be the problem? (Just "echo $userfile". Isn't it array?) Regards, -- Yasuo Ohgaki ----- Original Message ----- From: "Andrzej Swedrzynski" <kokosz@earthdawn.pl> To: <php-general@lists.php.net> Cc: "Yasuo Ohgaki" <yohgaki@hotmail.com> Sent: Sunday, May 06, 2001 3:08 AM Subject: Re: [PHP] Vanishing files. > 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 > >

« previous php.general (#51555) next »