B
Baria
Misafir
Kod:
if(!$posterr){
if(!isset($_GET["ipaddress"]) || ($_GET["ipaddress"] == "")) {
$ipaddress = $_SERVER['REMOTE_ADDR'];
$local = 1;
} else {
$ipaddress = $_GET["ipaddress"];
$local = 0;
}
$uniq = substr( md5(uniqid (rand())), 0, 10 );
$ext = strtolower( substr($_FILES['attached']['name'], -3));
move_uploaded_file($_FILES['attached']['tmp_name'], $att_path."/".$uniq.".".$ext );
$strQuery = "INSERT INTO images SET ";
$strQuery .= "filename='".$uniq.".".$ext."',";
$strQuery .= "ipaddress='{$ipaddress}',";
$strQuery .= "date='".time()."',";
$strQuery .= "pkey='{$uniq}',";
if($myuid){
$strQuery .= "user='{$myuid}',";
}
$strQuery .= "status='1'";
$result = mysql_query($strQuery) or die( mysql_error() );
$aid = mysql_insert_id();
if($aid){
$filen = $siteurl."/".str_replace('./', '', $att_path)."/".$uniq.".".$ext;
$filen = str_replace('http://','%%',$filen);
$filen = str_replace('//','/',$filen);
$filen = str_replace('%%','http://',$filen);
$step = 2;
}else{
$step = 1;
yukarıdaki bulunan kod ta benim yapmaya çalıştıgım image nin yükleme yerini deyiştirmek. amacım bu.
move_uploaded_file($_FILES['attached']['tmp_name'], $att_path."/".$uniq.".".$ext );
benim burda istedigim subdomaine yüklemetmek resmi ,böyle olunca sadece o hosta yükleye biliyorum. örnek olarak
move_uploaded_file($_FILES['attached']['tmp_name'], ftp://yüklenecek_olan.domain.com/$att_path."/".$uniq.".".$ext );
şeklinde gibi birşey
$att_path:yüklenecek klasör
$uniq:resmin adı
$ext:resmin uzantısı