From: Carsten <car...@ya...> - 2003-02-08 15:49:03
|
Hi Lawrence, It looks like you are using NathanGass' UploadPlugin from <http://phpwiki.sourceforge.net/phpwiki/UploadPlugin>? I never used it, but apparently you need to add a function to lib/Request.php before it will work. Carsten RCS file: /cvsroot/phpwiki/phpwiki/lib/Request.php,v retrieving revision 1.24 diff -U2 -r1.24 Request.php --- Request.php 14 Dec 2002 16:21:46 -0000 1.24 +++ Request.php 8 Feb 2003 15:46:52 -0000 @@ -314,5 +314,9 @@ return new Request_UploadedFile($fileinfo); } - + + function getTmpName() { + return $this->_info['tmp_name']; + } + function Request_UploadedFile($fileinfo) { $this->_info = $fileinfo; On Saturday, February 8, 2003, at 05:21 am, Lawrence F. London, Jr. wrote: > Greetings: > > I have been using UpLoad.php with Wiki version: 1.3.2-jeffs-hacks > successfully to upload files and would also like to use it > in 1.3.4 at this location: > > http://www.ibiblio.org/pbs/pbswiki/index.php/UploadFile > > I get the following error when trying to run it: > > Fatal error: Call to undefined function: gettmpname() in > /public/html/pbs/pbswiki/lib/plugin/UpLoad.php on line 38 > > Could the plugin's author or any other kind soul fix this for me so it > will work? > > Huge thanks in advance for any help. > > Lawrence > > Here's the code for UpLoad.php: > > <><><> > > <?php // -*-php-*- > class WikiPlugin_UpLoad > extends WikiPlugin > { > function getName () { > return "UpLoad"; > } > > function getDescription () { > return "Simple Plugin to load files up to server"; > } > > function getDefaultArguments() { > return array(); > } > > function run($dbi, $argstr, $request) { > $file_dir="/public/html/ecolandtech/pcwiki/pcwikiufu/"; > $url_prefix="http://www.ibiblio.org/pbs/pbswiki/files/"; > > $action = $request->getURLtoSelf(); > $userfile = $request->getUploadedFile( 'userfile' ); > $form = HTML::form( array( 'action' => $action, 'enctype' => > 'multipart/form-data', 'method' => 'post' ) ); > $contents = HTML::div( array( 'class' => 'wikiaction' ) ); > //$contents = HTML(); > $contents->pushContent( HTML::input( array( 'type' => 'hidden', > 'name' => 'MAX_FILE_SIZE', 'value' => MAX_UPLOAD_SIZE ) ) ); > $contents->pushContent( HTML::input( array( 'name' => > 'userfile', 'type' => 'file', 'size' => '50' ) ) ); > $contents->pushContent( HTML::br() ); > $contents->pushContent( HTML::input( array( 'value' => 'Upload', > 'type' => 'submit' ) ) ); > $form->pushContent( $contents ); > > //$message = HTML::div( array( 'class' => 'wikiaction' ) ); > $message = HTML(); > > if($userfile) { > $userfile_name = $userfile->getName(); > $userfile_name=basename($userfile_name); > $userfile_tmpname = $userfile->getTmpName(); > if( stristr( $userfile_name, ".php" ) || > stristr( $userfile_name, ".pl" ) || > stristr( $userfile_name, ".sh" ) || > stristr( $userfile_name, ".cgi" ) ) { > > $message->pushContent( "Files with extension .php, .pl, > .sh or .cgi are not allowed" ); > $message->pushContent( HTML::br() ); > $message->pushContent( HTML::br() ); > } elseif( file_exists( $file_dir.$userfile_name ) ) { > $message->pushContent( "There is already a file with name > $userfile_name uploaded" ); > $message->pushContent( HTML::br() ); > $message->pushContent( HTML::br() ); > } elseif( $userfile->getSize() > (MAX_UPLOAD_SIZE) ) { > $message->pushContent( "Sorry but this file is too big" ); > $message->pushContent( HTML::br() ); > $message->pushContent( HTML::br() ); > } elseif( move_uploaded_file($userfile_tmpname, > $file_dir.$userfile_name)) { > $message->pushContent( "file successfully uploaded to > location:" ); > $message->pushContent( HTML::br() ); > $message->pushContent( "$url_prefix$userfile_name" ); > $message->pushContent( HTML::br() ); > } else { > $message->pushContent( HTML::br() ); > $message->pushContent( "upload failed..." ); > $message->pushContent( HTML::br() ); > } > } else { > $message->pushContent( HTML::br() ); > $message->pushContent( HTML::br() ); > } > > //$result = HTML::div( array( 'class' => 'wikiaction' ) ); > $result = HTML(); > $result->pushContent( $form ); > $result->pushContent( $message ); > return $result; > } > } > > <><><> > > -- > L.F.London > lf...@in... > http://market-farming.com > http://www.ibiblio.org/ecolandtech/pcwiki/index.php/london |