|
| Support Queries This forum should be used to contact XILO's support team should you have any problems with your account. |
![]() |
| | LinkBack | Thread Tools | Display Modes |
(#21 (permalink))
|
| Techie & Moderator ![]() Posts: 753 Join Date: Apr 2006 Location: Swindon, UK | No problem GibMonkey - anytime ![]() Tom, the upload is the attachment mod for phpBB. The "business" end of the uploader seems to be the following code, although its hard to say where exactly it is failing as the error message presented is one built into the mod, not a pure one thrown out from php. Code: // Upload Attachment
if (!$error)
{
if (!(intval($attach_config['allow_ftp_upload'])))
{
// Descide the Upload method
$ini_val = ( phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var';
$safe_mode = @$ini_val('safe_mode');
if (@$ini_val('open_basedir'))
{
if (@phpversion() < '4.0.3')
{
$upload_mode = 'copy';
}
else
{
$upload_mode = 'move';
}
}
else if (@$ini_val('safe_mode'))
{
$upload_mode = 'move';
}
else
{
$upload_mode = 'copy';
}
}
else
{
$upload_mode = 'ftp';
}
// Ok, upload the Attachment
if (!$error)
{
$this->move_uploaded_attachment($upload_mode, $file);
}
}
// Copy the temporary attachment to the right location (copy, move_uploaded_file or ftp)
function move_uploaded_attachment($upload_mode, $file)
{
global $error, $error_msg, $lang, $upload_dir;
if (!is_uploaded_file($file))
{
message_die(GENERAL_ERROR, 'Unable to upload file. The given source has not been uploaded.', __LINE__, __FILE__);
}
switch ($upload_mode)
{
case 'copy':
if (!@copy($file, $upload_dir . '/' . basename($this->attach_filename)))
{
if (!@move_uploaded_file($file, $upload_dir . '/' . basename($this->attach_filename)))
{
$error = TRUE;
if(!empty($error_msg))
{
$error_msg .= '<br />';
}
$error_msg .= sprintf($lang['General_upload_error'], './' . $upload_dir . '/' . $this->attach_filename);
return;
}
}
@chmod($upload_dir . '/' . basename($this->attach_filename), 0666);
break;
case 'move':
if (!@move_uploaded_file($file, $upload_dir . '/' . basename($this->attach_filename)))
{
if (!@copy($file, $upload_dir . '/' . basename($this->attach_filename)))
{
$error = TRUE;
if(!empty($error_msg))
{
$error_msg .= '<br />';
}
$error_msg .= sprintf($lang['General_upload_error'], './' . $upload_dir . '/' . $this->attach_filename);
return;
}
}
@chmod($upload_dir . '/' . $this->attach_filename, 0666);
break;
case 'ftp':
ftp_file($file, basename($this->attach_filename), $this->type);
break;
}
if (!$error && $this->thumbnail == 1)
{
if ($upload_mode == 'ftp')
{
$source = $file;
$dest_file = THUMB_DIR . '/t_' . basename($this->attach_filename);
}
else
{
$source = $upload_dir . '/' . basename($this->attach_filename);
$dest_file = amod_realpath($upload_dir);
$dest_file .= '/' . THUMB_DIR . '/t_' . basename($this->attach_filename);
}
if (!create_thumbnail($source, $dest_file, $this->type))
{
if (!$file || !create_thumbnail($file, $dest_file, $this->type))
{
$this->thumbnail = 0;
}
}
}
}
Thanks for your help ![]() |
| |
(#23 (permalink))
|
| XILO Staff ![]() Posts: 694 Join Date: Nov 2005 | Glad to hear it Kieran. Thanks for letting us know. Matt Internet Hosting and Online Services w: http://www.xilo.net/ h: http://my.xilo.net/ t: +44 (0) 845 034 6444 f: +44 (0) 845 034 6555 |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| File query | Simon | Support Queries | 9 | 12/07/2007 1:39 PM |
| FTP upload file size | mcoops | Support Queries | 1 | 30/01/2007 5:49 PM |
| Permissions on a config file | iain2_uk | Support Queries | 3 | 17/07/2006 6:46 PM |
Powered by vBulletin | XHTML | © Copyright 2003-2008 XILO Communications Ltd. All rights reserved. E&OE