Changeset 1085 in subversion
- Timestamp:
- Feb 14, 2008 6:49:30 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/steps/mail/upload.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/steps/mail/upload.inc
r850 r1085 37 37 $response = ''; 38 38 39 foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath)39 if (is_array($_FILES['_attachments']['tmp_name'])) 40 40 { 41 $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); 42 if (move_uploaded_file($filepath, $tmpfname)) 41 foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) 43 42 { 44 $id = count($_SESSION['compose']['attachments']); 45 $_SESSION['compose']['attachments'][] = array('name' => $_FILES['_attachments']['name'][$i], 43 $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); 44 if (move_uploaded_file($filepath, $tmpfname)) 45 { 46 $id = count($_SESSION['compose']['attachments']); 47 $_SESSION['compose']['attachments'][] = array('name' => $_FILES['_attachments']['name'][$i], 46 48 'mimetype' => $_FILES['_attachments']['type'][$i], 47 49 'path' => $tmpfname); 48 50 49 if (is_file($CONFIG['skin_path'] . '/images/icons/remove-attachment.png'))50 $button = sprintf(51 '<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />',52 $CONFIG['skin_path'],53 Q(rcube_label('delete')));54 else55 $button = Q(rcube_label('delete'));51 if (is_file($CONFIG['skin_path'] . '/images/icons/remove-attachment.png')) 52 $button = sprintf( 53 '<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', 54 $CONFIG['skin_path'], 55 Q(rcube_label('delete'))); 56 else 57 $button = Q(rcube_label('delete')); 56 58 57 $content = sprintf(58 '<a href="#delete" onclick="return %s.command(\'remove-attachment\', \'rcmfile%d\', this)" title="%s">%s</a>%s',59 JS_OBJECT_NAME,60 $id,61 Q(rcube_label('delete')),62 $button,63 Q($_FILES['_attachments']['name'][$i]));59 $content = sprintf( 60 '<a href="#delete" onclick="return %s.command(\'remove-attachment\', \'rcmfile%d\', this)" title="%s">%s</a>%s', 61 JS_OBJECT_NAME, 62 $id, 63 Q(rcube_label('delete')), 64 $button, 65 Q($_FILES['_attachments']['name'][$i])); 64 66 65 $OUTPUT->command('add2attachment_list', "rcmfile$id", $content);66 }67 else // upload failed68 {69 $err = $_FILES['_attachments']['error'][$i];70 if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE)71 $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize'))))));72 else73 $msg = rcube_label('fileuploaderror');67 $OUTPUT->command('add2attachment_list', "rcmfile$id", $content); 68 } 69 else // upload failed 70 { 71 $err = $_FILES['_attachments']['error'][$i]; 72 if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) 73 $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); 74 else 75 $msg = rcube_label('fileuploaderror'); 74 76 75 $OUTPUT->command('display_message', $msg, 'error'); 77 $OUTPUT->command('display_message', $msg, 'error'); 78 } 76 79 } 77 80 } 78 79 81 80 82 // send html page with JS calls as response
Note: See TracChangeset
for help on using the changeset viewer.
