|
|
|
ผมทำ form upload เก็บข้อมูลเป็นไฟล์ แต่อยากให้ move_uploaded_file ไปเก็บใน folder ด้วย ต้องเพิ่มโค้ดตรงไหนครับ |
|
|
|
|
|
|
|
Code (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"] == "form1")) {
$insertSQL = sprintf("INSERT INTO om1 (nametype, cm, data_flie, dateInput) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['nametype'], "text"),
GetSQLValueString($_POST['cm'], "text"),
GetSQLValueString($_POST['data_flie'], "text"),
GetSQLValueString($_POST['dateInput'], "date"));
mysql_select_db($database_Project, $Project);
$Result1 = mysql_query($insertSQL, $Project) or die(mysql_error());
$insertGoTo = "Data1_upload.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
if($_SESSION['Status'] != "USER")
{
echo "This page for User only!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("Project");
mysql_query("SET NAMES UTF8");
$strSQL = "SELECT * FROM member WHERE UserID = '".$_SESSION['UserID']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
Tag : PHP
|
|
|
|
|
|
Date :
2015-03-21 16:43:59 |
By :
teeratusz |
View :
658 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้ว move_uploaded_file ที่ทำไว้อยู่ไหนครับ หรือยังไม่ได้ทำ
ิเสริชหาเอาเลยครับ ใต้บล๊อคนี้ ก่อน บล็อค คีย์ข้อความ ค้นหาข้อมูล ใส่เข้าไปเลย move_uploaded_file
|
|
|
|
|
Date :
2015-03-21 18:46:49 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่ได้ทำครับ ผมมือใหม่ไม่ทราบว่า move_uploaded_file นำไปใส่ตรงไหนอะครับ T^T
|
|
|
|
|
Date :
2015-03-21 19:27:13 |
By :
teeratusz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|