3
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 + 1 ));
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