2006.10.20 Friday | 10:51

  Ajax ファイル存在チェック ふるいむかし

file_exist.php

<?
header( "Content-Type: text/html; Charset=utf-8" );
header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );

$prefix = $_GET['prefix'];
$file_path = $_GET['path'];
$file_path = str_replace( "\\", "/", $file_path );
$file_name = basename( $file_path );

if ( trim( $prefix ) != '' ) {
	$file_path = "image/$prefix-$file_name";
}
else {
	$file_path = "image/$file_name";
}

if ( file_exists ( $file_path ) ) {
	print "OK";
}
else {
	print "ERR";
}

?>