Exemplo n.º 1
0
        $ext = strrchr($_FILES["photo"]['name'][$key], ".");
        $ran_num = (time() | 0) . "_" . rand(0, 999999999);
        $output_path = "../../gallery_activity/";
        $file_name = $id . "_{$ran_num}.png";
        $ori_file_name = $id . "_{$ran_num}{$ext}";
        //		$size = GetImageSize($upfile);
        // copy($upfile,$output_path.$file_name);
        //		image_resize( $upfile, $output_filename, $output_path, 190, 120);
        //		// copy($upfile,$output_path."small/".$file_name);
        //		image_resize( $upfile, $output_filename, $output_path, 90, 60);
        //		copy( $upfile,  $output_path."original/".$ori_file_name );
        $image = (require_once "../../include/image.class.php");
        $image = new image();
        $image->source = $_FILES['photo']["tmp_name"][$key];
        $image->allow_size = 5;
        $image->save_path = "../../gallery_activity/";
        $image->save_name = $ori_file_name;
        if ($image->upload()) {
            // mysql_query("INSERT INTO tbl_file_attachment (`file_id`, `url`) value({$last_insert_id}, '{$filename}');");
            $image->create_img(190, 120, 0, NULL, "web");
            $image->create_img(90, 60, 0, NULL, "thumb");
        }
        $sql_c = "INSERT INTO `tbl_activity_gallery` ( `act_id`, `file_name`, `ori_file_name`, `remark`, `g_order` ) VALUES ('{$id}', '{$ori_file_name}', '{$ori_file_name}', '{$remark}', {$g_order} )";
        mysql_query("set names utf8");
        mysql_query($sql_c, $link_id);
    }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
/*										End Upload Photo       										*/
//////////////////////////////////////////////////////////////////////////////////////////////////////
mysql_close();
Exemplo n.º 2
0
 if (is_uploaded_file($_FILES["n_photo"]['tmp_name'])) {
     $uploadfilename = basename($_FILES['n_photo']['name']);
     $suffix = explode('.', $uploadfilename);
     $suffix = $suffix[count($suffix) - 1];
     if (in_array($suffix, array("php", "php3"))) {
         exit("<script>alert('Disallow file type.');history.back(-1);</script>");
     }
     $filename = "p" . $last_insert_id . "_" . date("YmdHis") . rand(10000, 99999) . '.' . $suffix;
     require_once '../../include/image.class.php';
     $image = new image();
     $image->source = $_FILES['n_photo']["tmp_name"];
     $image->allow_size = 5;
     $image->save_path = "../../file_download/";
     $image->save_name = $filename;
     if ($image->upload()) {
         $image->create_img(222, 148, 0, NULL, "thumb");
         $query = "UPDATE  `tbl_chancellor`   SET   file_photo='{$filename}'   WHERE   file_id={$last_insert_id} ";
         mysql_query($query);
     } else {
         print_r($image->err_log);
         exit;
     }
 }
 $filename = $_FILES["n_file"]['name'];
 $new_filename = $last_insert_id . "_" . (time() | 0) . substr($filename, -4);
 if (isset($_FILES["n_file"]["tmp_name"]) && $_FILES["n_file"]["tmp_name"] != "") {
     if (!copy($_FILES["n_file"]["tmp_name"], "../../file_download/" . $new_filename)) {
         echo "Fail to copy doc file - " . $_FILES["n_file"]["tmp_name"];
         exit;
     } else {
         $query = "UPDATE  `tbl_chancellor`   SET   file_file_name='{$new_filename}'   WHERE   file_id={$last_insert_id} ";