PDA

View Full Version : مبتدی: توضیح برای یک قسمت از کد آپلود



smemamian
شنبه 09 دی 1391, 20:25 عصر
سلام دوستان

کسی می تونه به زبان ساده این قسمت از کد رو معرفی کنه ؟


####### Code Starting #######


if (!$file_name) die("$no_file");

if ($file_size > $max_upload_size) {
die("$to_big_file");
}

if ($allow_file_type == "1") {
if ($type != $allowtype) {
die("$not_correct_file");
}
}

if (file_exists("$upload_directory/$file_name")) {
die("$already_uploaded");
}

@copy($file, "$upload_directory/$file_name") or die("$error_write_file");

# EOF!
echo "<center><b>$thank_you";
?>

Tarragon
شنبه 09 دی 1391, 20:48 عصر
<?php
if (!$file_name) die("$no_file"); //error agar file vojood nadasht

if ($file_size > $max_upload_size) { //agar hajm file upload shode bishtar az hade aksar bood
die("$to_big_file");
}

if ($allow_file_type == "1") { // agar type file sahih bood
if ($type != $allowtype) {
die("$not_correct_file");
}
}

if (file_exists("$upload_directory/$file_name")) { //agar file ba in nam vojood dasht error mide
die("$already_uploaded");
}

@copy($file, "$upload_directory/$file_name") or die("$error_write_file"); //inam ye function e ke nadidam ama kare hamoon move_uploaded_file ro mikone va file ro dar host zakhire mikone

# EOF!
echo "<center><b>$thank_you"; //payam sahih upload shodan ro neshoon mide
?>

smemamian
شنبه 09 دی 1391, 23:10 عصر
خیلی ممنونم !

این قسمت رو نفهمیدم :


@copy($file, "$upload_directory/$file_name") or die("$error_write_file");

mamali-mohammad
شنبه 09 دی 1391, 23:15 عصر
میگه فایل رو به این مسیر منتقل کن
اگه منتقل شد که هیچ اگه نشد خطا میده