アットウィキロゴ
mildheven @ ウィキ
掲示板 掲示板 ページ検索 ページ検索 メニュー メニュー

mildheven @ ウィキ

ファイルアップローダ、IFLAME出力

最終更新:

mildheven

- view
管理者のみ編集可
コントロール
<?
header( "Content-Type: text/html; Charset=euc-jp" );
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );
 
# **********************************************************
# 外部ファイル
# **********************************************************
$conf_client_charset = "euc-jp";
$conf_db_type = 1;
require_once( "http://homepage2.nifty.com/lightbox/gen/db.php" );
 
if ( $_GET['debug'] == 'y' ) {
	print "<PRE>";
	print_r($_GET);
	print "</PRE>";
}
 
# **********************************************************
# 接続
# **********************************************************
$SQL = new DB( "localhost", "lightbox", "root", "password" );
 
require( "view_iflame.php" );
?>
 

View
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-type" content="text/html; charset=euc-jp">
<SCRIPT 
	charset="euc-jp"
	language="javascript"
	type="text/javascript"
	src="http://homepage2.nifty.com/lightbox/lightboxtool.js">
</SCRIPT>
 
<SCRIPT language="javascript" type="text/javascript">
 
var obj;
var iframe;
var iframe2;
 
// *********************************************************
// local class
// *********************************************************
function lbox_local() {
	this.func_btn1 = function( ) {
 
 
		// メインオブジェクト作成
		obj = new lightboxtool();
 
		// IFRAME 操作オブジェクト作成
		iframe = new obj.openFrame( "area", "if", true, true );
 
		// フォームのターゲットを変更
		document.getElementById("frm").target = "if";
 
 
	}
	this.func_btn2 = function( ) {
 
		iframe.$3("BODY").innerHTML =
			"OK";
 
	}
	this.func_btn3 = function( ) {
 
		alert( iframe.$2("btn").value )
 
	}
	this.func_btn4 = function( ) {
 
		iframe.absolute();
		iframe.location( 300, 400 );
 
	}
}
// *********************************************************
// instance
// *********************************************************
var lbox = new lbox_local();
 
</SCRIPT>
 
</head>
 
<body>
 
<?
$Query = "select * from password";
$Column = $SQL->QueryEx( $Query );
 
if ($_POST['btn1'] != '' ){
	if ( $Column['pasword_body'] == $_POST['password']) {
 
			$file_dir = "./file/";
			$file_path = $file_dir;
			$_FILES["uploadfile"]["name"] = mb_convert_encoding($_FILES["uploadfile"]["name"], "sjis", "euc-jp");
			$file_path .=$_FILES["uploadfile"]["name"];
 
			if(move_uploaded_file($_FILES["uploadfile"]["tmp_name"],$file_path)) {
 
				$img_dir = "./file/";
				$img_path = $img_dir;
				$img_path .= $_FILES["uploadfile"]["name"];
				$size = getimagesize($file_path);
 
				print "OK";
 
			}
 
	}else{
		print "パスワードが違います";
	}
	exit;
}
?>
 
		<FORM	
			id = "frm"
			name="form1"
			method="POST"
			enctype="multipart/form-data"
		>
		<INPUT
			type="hidden"
			name="MAX_FILE_SIZE"
			value="1000000"
		>
 
		<table>
			<tr>
				<td>
					<INPUT
						type="file"
						name="uploadfile"
						value="参照"
					>
					<INPUT
						type="submit" 
						value="送信"
						name="btn1"
						onClick='lbox.func_btn1();'
						style='width:120px;'
					>
 
				</td>
			</tr>
			<tr>
				<td>
					パスワード<br>
					<INPUT
						type="text"
						name="password"
					>
				</td>
			<tr>
				<td>
				<IMG
					src="inner2.php"
					border="0"
					galleryimg="no" />
				</td>
			<TR>
				<TD class="column">
					<DIV
						id="area"
						style='
							width:400px;
							height:20px;
							border-color:#000000;
						'
					></DIV>
				</TD>
			</TR>
		</table>
 
		</FORM>
</body>
</div>
</html>
 
 
最近更新されたスレッド
ウィキ募集バナー