//これはサンプル ファイルのアップロードです。私のローカルホストでは問題なく動作しますが、イントラネットでは動作しませんでした.. //これは私のコードです
<?php require_once "../session.php" ?>
<?php
$host='localhost'; // My hostname
$username='root'; // Mysql username
$password='*******'; // Mysql password
$db_name='jobs'; // DB name
// Connect to server and select database.
mysql_connect($host, $username, $password)or die("Cannot Connect");
mysql_select_db($db_name);
// Where the file is going to be placed
$TARGET_PATH = "uploads/";
// Get our POSTed variables
$uploadedfile = $_FILES['uploadedfile'];
// Sanitize our inputs
$uploadedfile['name'] = mysql_real_escape_string($uploadedfile['name']);
// Build our target path full string. This is where the file will be moved do
// i.e. images/picture.jpg
$TARGET_PATH .= $uploadedfile['name'];
/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if (move_uploaded_file($uploadedfile['tmp_name'], $TARGET_PATH))
{
$sql = "update personal set resume='" . $uploadedfile['name'] . "' where username='".$_SESSION['name']."'";
$result = mysql_query($sql) or die ("Could not insert data into DB: " . mysql_error());
header("Location: ../scripts/view.php");
exit;
}
else
{
echo "There was an error uploading the file, please try again!";
}
?>
これは私のPC(wampを使用するlocalhost)でのみ機能します。:(((