Scusa
volevo dire da qui:
Codice PHP:
/***************************************
** PHP3 file upload function.
***************************************/
function file_upload_php3($key, $value){
if(substr($key,-5) != '_file' AND substr($key,-14) != '_file_required') return FALSE;
if(substr($key,-9) == '_required' AND ($value == 'none' OR $value == '')){
global $required_error;
header('Location: '.$required_error);
exit;
}
if($value != 'none' AND $value != ''){
global $num_attachments, $mail;
if(get_magic_quotes_gpc() == 1 AND (is_long(strpos(strtolower($value), 'windows')) OR is_long(strpos(strtolower($value), 'winnt')))) $value = stripslashes($value);
$ctype = $key.'_type';
$filename = $key.'_name';
global $$filename, $$ctype;
$attachment = fread($fp = fopen($value, 'r'), filesize($value)); fclose($fp);
$mail->add_attachment($attachment, $$filename, $$ctype);
$num_attachments++;
}
return TRUE;
}
/***************************************
** And this bit handles file uploads for
** php4.
***************************************/
function file_upload_php4($HTTP_POST_FILES){
if(isset($HTTP_POST_FILES) AND is_array($HTTP_POST_FILES)){
while(list($key, $attributes) = each($HTTP_POST_FILES)){
if($attributes['tmp_name'] != 'none' AND $attributes['tmp_name'] != ''){
global $num_attachments, $mail;
if(get_magic_quotes_gpc() == 1 AND (is_long(strpos(strtolower($attributes['tmp_name']), 'windows')) OR is_long(strpos(strtolower($attributes['tmp_name']), 'winnt')))) $attributes['tmp_name'] = stripslashes($attributes['tmp_name']);
$ctype = $attributes['type'];
$origname = $attributes['name'];
$attachment = fread($fp = fopen($attributes['tmp_name'], 'r'), filesize($attributes['tmp_name'])); fclose($fp);
$mail->add_attachment($attachment, $origname, $ctype);
$num_attachments++;
}elseif(substr($key, -9) == '_required'){
global $required_error;
header('Location: '.$required_error);
exit;
}
}
}
}