私はこの作品をかなりの期間作ろうとしています。しかし、私はそれを動作させるように思えない。私はphp mysqlで複数形式の画像をアップロード
if (isset($_POST['multi_fresh'])) {
$path = '';
$user_id = $_REQUEST['user_id'];
$classification = $_REQUEST['classification'];
$yield = $_REQUEST['yield'];
$price = $_REQUEST['price'];
$farm_name = $_REQUEST['farm_name'];
foreach ($_FILES["farm_photo"]["tmp_name"] as $key => $tmp_name) {
$cl = $classification[$key];
$yl = $yield[$key];
$pr = $price[$key];
$fn = $farm_name[$key];
$im = $img[$key];
if (!empty($pr)) {
$type = $im['type'];
$size = $im['size'];
$name = $im['name'];
$tmp_path = $im['tmp_name'];
$upload = $path . "images/farm/";
if (($type == 'image/jpg' || $type == 'image/jpeg' || $type == 'image/png' || $type == 'image/gif') && $size < 5000000) {
$ext = pathinfo($name, PATHINFO_EXTENSION);
$farmimage = date('YmdHis') . "." . $ext;
if (move_uploaded_file($tmp_path, $upload . $farmimage)) {
$insert = mysql_query("INSERT INTO user_multi_farm set user_id='" . mysql_real_escape_string($user_id) . "',classification='" . mysql_real_escape_string($cl) . "',yield='" . mysql_real_escape_string($yl) . "',price='" . mysql_real_escape_string($pr) . "',farm_name='" . mysql_real_escape_string($fn) . "',farm_photo='" . mysql_real_escape_string($farmimage) . "'") or die(mysql_error());
if ($insert) {
$sld_ins = "Add Sucessfully!";
} else {
$sld_err = "Check Corresponding Fields";
}
}
} else {
$inserts = mysql_query("INSERT INTO user_multi_farm set user_id='" . mysql_real_escape_string($user_id) . "',classification='" . mysql_real_escape_string($cl) . "',yield='" . mysql_real_escape_string($yl) . "',price='" . mysql_real_escape_string($pr) . "',farm_name='" . mysql_real_escape_string($fn) . "'") or die(mysql_error());
if ($inserts) {
$sld_ins = "Add Sucessfully!";
} else {
$sld_err = "Check Corresponding Fields";
}
}
}
}
ようこそ! [ツアー](http://stackoverflow.com/tour)を見て回り、[ヘルプセンター](http://stackoverflow.com/help)、特に[どのように私に質問しますか良い質問ですか?(http://stackoverflow.com/help/how-to-ask) – Squazz
私はこのコードを使用しましたが、私は結果を得ることができません.... –