|
 |
|
รบกวนช่วยดูCode หน่อยครับ คือว่ามันสามารถอัพโหลดรูปได้ แต่ที่นี้มันไม่อยู่ใน path ที่เก็บรูปมันไม่มีรูปเข้ามา ผมไม่แน่ใจว่า Code ผิดตรงไหน |
|
 |
|
|
 |
 |
|
รบกวนช่วยดูCode หน่อยครับ คือว่ามันสามารถอัพโหลดรูปได้ แต่ที่นี้มันไม่อยู่ใน path ที่เก็บรูปมันไม่มีรูปเข้ามา ผมไม่แน่ใจว่า Code ผิดตรงไหน
อันนี้เป็นCode ที่เก็บเป็น path นะครับ
Code (PHP)
<?php
function dwUpload($file,$path="/admin/img-products/"){
if(@copy($file['tmp_name'],$path.$file['name'])){
@chmod($path.$file,0777);
return $file['name'];
}else{
return false;
}
}
?>
อันนี้โค๊ดหน้า ฟรอมนะครับ
Code (PHP)
<?php require_once('../Connections/myconect.php'); ?>
<?php include("dw-upload.inc.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO profile (EmpID, Name, LastName, Birthday, Department, Sex, Address, Phone, Email, Username, Password, Status, imags, salary) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['EmpID'], "text"),
GetSQLValueString($_POST['Name'], "text"),
GetSQLValueString($_POST['LastName'], "text"),
GetSQLValueString($_POST['Birthday'], "date"),
GetSQLValueString($_POST['Deparment'], "text"),
GetSQLValueString($_POST['Sex'], "text"),
GetSQLValueString($_POST['Address'], "text"),
GetSQLValueString($_POST['Phone'], "text"),
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['Username'], "text"),
GetSQLValueString($_POST['Password'], "text"),
GetSQLValueString($_POST['Status'], "text"),
GetSQLValueString($_FILES['imags'], "text"),
GetSQLValueString($_POST['salary'], "int"));
mysql_select_db($database_myconect, $myconect);
$Result1 = mysql_query($insertSQL, $myconect) or die(mysql_error());
}
mysql_select_db($database_myconect, $myconect);
$query_Recordset1 = "SELECT * FROM profile";
$Recordset1 = mysql_query($query_Recordset1, $myconect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<input type="file" name="imags" id="immags">
Tag : PHP, jQuery, CakePHP

|
ประวัติการแก้ไข 2014-12-08 02:05:52
|
 |
 |
 |
 |
Date :
2014-12-08 02:03:49 |
By :
ิbed02925 |
View :
1440 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใช้อะไรเป็น Server ครับ
ดูจากวิธีการอ้าง path เรียกว่าการอ้างแบบ direct อ้างแบบโดยตรง
ซึ่งวิธีการนี้คุณต้องรู้จัก path ของคุณ
การทดสอบ
print_r( $_SERVER); เป็นการแสดงค่า environment สภาพแวดล้อม ของ server นะครับ
ลองอ่านตาม ชื่อข้อมูล ที่เกี่ยวกับ path ดูนะครับ
และคิดว่าคงได้ประโยชน์อย่างอื่นด้วย
|
 |
 |
 |
 |
Date :
2014-12-08 04:50:09 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|