예제 #1
0
             }
         }
         $db->query('DELETE FROM ' . $db->pre . 'uploads WHERE mid = "' . $upinfo['name'] . '" AND id IN (' . implode(',', $ids) . ')', __LINE__, __FILE__);
         viscacha_header('Location: attachments.php?type=' . $_GET['type'] . '&id=' . $_GET['id'] . SID2URL_JS_x);
     }
 } else {
     $insertuploads = array();
     $inserterrors = array();
     require "classes/class.upload.php";
     for ($i = 0; $i < $config['tpcmaxuploads']; $i++) {
         if (empty($_FILES['upload_' . $i]['name'])) {
             continue;
         }
         $my_uploader = new uploader();
         $my_uploader->max_filesize($config['tpcfilesize']);
         $my_uploader->max_image_size($config['tpcwidth'], $config['tpcheight']);
         if ($my_uploader->upload('upload_' . $i, explode('|', $config['tpcfiletypes']), 1)) {
             $my_uploader->save_file('uploads/topics/', '2');
         }
         if ($my_uploader->return_error()) {
             array_push($inserterrors, $my_uploader->return_error());
         }
         array_push($insertuploads, $my_uploader->file['name']);
     }
     if (count($inserterrors) > 0) {
         error($inserterrors, 'attachments.php?type=' . $_GET['type'] . '&amp;id=' . $_GET['id'] . SID2URL_x);
     }
     if ($_GET['type'] == 'edit' && ($my->mp[0] == 1 || $upinfo['name'] == $my->id)) {
         $upper = $upinfo['name'];
         $tid = $upinfo['id'];
     } else {
예제 #2
0
     }
 }
 $insertuploads = array();
 $inserterrors = array();
 require "classes/class.upload.php";
 $success = 0;
 for ($i = 0; $i < $ups; $i++) {
     if (empty($_FILES['upload_' . $i]['name'])) {
         continue;
     }
     $my_uploader = new uploader();
     $my_uploader->max_filesize($filesize);
     $my_uploader->file_types($filetypes);
     $my_uploader->set_path($dir . DIRECTORY_SEPARATOR);
     if (isset($imgwidth) && isset($imgheight)) {
         $my_uploader->max_image_size($imgwidth, $imgheight);
     }
     if ($my_uploader->upload('upload_' . $i)) {
         $my_uploader->save_file();
     }
     if ($my_uploader->upload_failed()) {
         array_push($inserterrors, $my_uploader->get_error());
     }
     $file = $dir . DIRECTORY_SEPARATOR . $my_uploader->fileinfo('filename');
     if (!file_exists($file)) {
         $inserterrors[] = $lang->phrase('admin_explorer_file_does_not_exist');
     } else {
         $success++;
     }
 }
 echo head();
 	$my_uploader->upload('userfile', 'image/gif', '.gif');
 	$my_uploader->save_file('uploads/', 2);
 	
 	if ($my_uploader->error) {
 		print($my_uploader->error . "<br><br>\n");
 	} else {
 		print("Thanks for uploading " . $my_uploader->file['name'] . "<br><br>\n");
 	}
 */
 // Create a new instance of the class
 $my_uploader = new uploader($_POST['language']);
 // for error messages in french, try: uploader('fr');
 // OPTIONAL: set the max filesize of uploadable files in bytes
 $my_uploader->max_filesize(15000000);
 // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
 $my_uploader->max_image_size(8000, 8000);
 // max_image_size($width, $height)
 // UPLOAD the file
 if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
     $my_uploader->save_file($path, $mode);
 }
 if ($my_uploader->error) {
     echo $my_uploader->error . "<br><br>\n";
 } else {
     // Successful upload!
     print $my_uploader->file['name'] . " was successfully uploaded to {$path}! <a href=\"" . $_SERVER['PHP_SELF'] . "\">Try Again</a><br>";
     // Print all the array details...
     //print_r($my_uploader->file);
     // ...or print the file
     if (stristr($my_uploader->file['type'], "image")) {
         $filename = $my_uploader->file['name'];
예제 #4
0
//
// 저장 옵션:
// 1 = 같은 이름의 파일이 존재 하면 덮어 씁니다.
// 2 = 같은 이름의 파일이 존재할 경우, 파일 이름 뒤에 _copy,jpg, _copy1.jpg ... 식으로 이름을 붙입니다.
// 3 = 같은 이름의 파일이 존재할 경우, 업로드하지 않습니다.
//
define('SAVE_OPTION', 2);
if ($_REQUEST['do'] == "submit") {
    require_once "imageupload-class.php";
    $attach = new uploader();
    //////////////////////////////////////////////////////////////////////////
    // 옵션:
    //
    // $attach->max_filesize(102400);        // 이미지 업로드 최대 크기
    // $attach->max_image_size(1024, 1024);  // 이미지 가로, 세로 최대 픽셀 크기
    $attach->max_image_size(8096, 8096);
    $success = $attach->upload("AttachFile", ALLOW_FORMAT, "");
    if ($success) {
        $success = $attach->save_file(SAVE_AS_DIRECTORY, SAVE_OPTION);
        $filename = SAVE_AS_URL . $attach->file['name'];
        echo '<script type="text/javascript">';
        echo 'var obj = parent.window.insert_form;';
        echo 'obj.attachSuccess(\'' . $filename . '\');';
        echo '</script>';
    } else {
        if ($attach->errors) {
            $msg = '';
            while (list($k, $v) = each($attach->errors)) {
                $msg .= $v;
            }
            echo '<script type="text/javascript">';
예제 #5
0
    		window.close();
		}
	//-->
	</SCRIPT>
</HEAD>
<BODY>
<?php 
#--------------------------------#
# PHP
#--------------------------------#
if (isset($_REQUEST['submitted'])) {
    $my_uploader = new uploader($lang['ThisLanguage']);
    // OPTIONAL: set the max filesize of uploadable files in bytes
    $my_uploader->max_filesize(30000);
    // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
    $my_uploader->max_image_size($options->picWidth, $options->picHeight);
    // max_image_size($width, $height)
    // UPLOAD the file
    if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
        $my_uploader->save_file($path, $mode);
    }
    // RETURN RESULTS
    if ($my_uploader->error) {
        echo $my_uploader->error . "<P>\n";
    } else {
        // Successful upload!
        echo "<FORM WIDTH = \"450\" NAME=\"form\"><INPUT TYPE=\"hidden\" NAME=\"pictureURL\" VALUE=\"" . $my_uploader->file['name'] . "\"></FORM>\n";
        echo "<B>" . $lang['UP_OK'] . "</B>";
        echo "<BR>URL: " . $my_uploader->file['name'];
        echo "<P><A HREF=\"#\" onClick=\"updateOpener();\">" . $lang['UP_USE_MUG'] . "\n";
        // End the page.