1
indream
Image upload problem
  • 2005/11/23 19:39

  • indream

  • Not too shy to talk

  • Posts: 170

  • Since: 2004/9/21


I have only image upload problem on XOOPS 2.0.13.2


XOOPS 2.0.13.1's uploader.php is work perfect
but XOOPS 2.0.13.2's uploader.php is not upload
(only image files)image files.

ERROR:
Quote:


Warning [PHP]: getimagesize(): open_basedir restriction in effect. File(/var/tmp/phpV4afZ7) is not within the allowed path(s): (/usr/home/SITE/:/usr/lib/php:/usr/local/lib/php:/tmp) in file /usr/home/SITE/public_html/class/uploader.php line 190


Warning [PHP]: getimagesize(/var/tmp/phpV4afZ7): failed to open stream: Operation not permitted in file /usr/home/SITE/public_html/class/uploader.php line 190



Xoops 2.0.13.2
Operating system FreeBSD
Kernel version 5.4-RELEASE-p6
Machine Type i386
Apache version 1.3.33 (Unix)
PERL version 5.8.7
PHP version 4.3.11
MySQL version 4.0.26

can anyone help me ?

2
m0nty
Re: Image upload problem
  • 2005/11/23 20:07

  • m0nty

  • XOOPS is my life!

  • Posts: 3337

  • Since: 2003/10/24



3
indream
Re: Image upload problem
  • 2005/11/23 22:07

  • indream

  • Not too shy to talk

  • Posts: 170

  • Since: 2004/9/21


function fetchMedia($media_name$index null)
    {
        if ( empty( 
$this->extensionToMime ) ) {
            
$this->setErrors'Error loading mimetypes definition' );
            return 
false;
        }
        if (!isset(
$_FILES[$media_name])) {
            
$this->setErrors('File not found');
            return 
false;
        } elseif (
is_array($_FILES[$media_name]['name']) && isset($index)) {
            
$index intval($index);
            
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$media_name]['name'][$index]) : $_FILES[$media_name]['name'][$index];
            
$this->mediaType $_FILES[$media_name]['type'][$index];
            
$this->mediaSize $_FILES[$media_name]['size'][$index];
            
$this->mediaTmpName $_FILES[$media_name]['tmp_name'][$index];
//resim up sorunu        $this->mediaError = !empty($_FILES[$media_name]['error'][$index]) ? $_FILES[$media_name]['errir'][$index] : 0;
                
$this->mediaError = !empty($_FILES[$media_name]['error'][$index]) ? $_FILES[$media_name]['error'][$index] : 0;
        } else {
            
$media_name =& $_FILES[$media_name];
            
$this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($media_name['name']) : $media_name['name'];
            
$this->mediaName $media_name['name'];
            
$this->mediaType $media_name['type'];
            
$this->mediaSize $media_name['size'];
            
$this->mediaTmpName $media_name['tmp_name'];
            
$this->mediaError = !empty($media_name['error']) ? $media_name['error'] : 0;
        }
        if ( (
$ext strrpos$this->mediaName'.' )) !== false ) {
//resim up sorunu        $ext = substr( $this->mediaName, $ext + 1 );
            
$ext strtolower(substr$this->mediaName$ext ));
            if ( isset( 
$this->extensionToMime[$ext] ) ) {
                
$this->mediaRealType $this->extensionToMime[$ext];
                
//trigger_error( "XoopsMediaUploader: Set mediaRealType to {$this->mediaRealType} (file extension is $ext)", E_USER_NOTICE );
            
}
        }
        
$this->errors = array();
        if ( 
$ext && in_array$ext, array( 'gif''jpg''jpeg''png''bmp''xbm' ) ) ) {
               
// Prevent sending of invalid images that would crash IE
            
if ( ! ( $info getimagesize$this->mediaTmpName ) ) ) {
                
$this->setErrors'Invalid file content' );
                return 
false;
            }
        }
        if (
intval($this->mediaSize) < 0) {
            
$this->setErrors('Invalid File Size');
            return 
false;
        }
        if (
$this->mediaName == '') {
            
$this->setErrors('Filename Is Empty');
            return 
false;
        }
        if (
$this->mediaTmpName == 'none' || !is_uploaded_file($this->mediaTmpName)) {
            
$this->setErrors('No file uploaded');
            return 
false;
        }
        if (
$this->mediaError 0) {
            
$this->setErrors('Error occurred: Error #'.$this->mediaError);
            return 
false;
        }
        return 
true;
    }


thanks bro i make it but this not solution for my problem.

XOOPS 2.0.13.1 uploader.php is work

XOOPS 2.0.13.2 uploader.php is not

im searching to changes now for solution

4
tuxtail
Re: Image upload problem
  • 2006/6/22 15:56

  • tuxtail

  • Just popping in

  • Posts: 4

  • Since: 2004/10/11


just figured it out

Had the same issue...

On the form you create try this:

$form->setExtra("enctype='multipart/form-data'");


Somehow this isn't done automatically when XoopsFormFile is used....

Hope this works for you... let us hear...

/tuxtail

Login

Username:
Password:

Lost Password? Register now!

Who's Online

69 user(s) are online (40 user(s) are browsing Support Forums)


Members: 0


Guests: 69


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits