Hi,
I am new to PHP scripting and need someones help with my current image uploader. I want it to save the images at http://free.hostultra.com/~av8airlines/upload_pic rather than where it is currently putting them on my server. If someone could rewrite the script so it saves them I would really appreciate it. The script is below:
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: x-small;
}
body {
margin-left: 24px;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<?php
include "install/config.php";
MySQL_connect("$host","$login_name","$password") or die("could not connect to the MYSQL");
MySQL_select_db("$database") or die("Could not select database");
$get_pilot = "SELECT * FROM pilots WHERE PASS = '$pass'";
$gopilot = mysql_query($get_pilot);
while ($data = mysql_fetch_array($gopilot)) {
$lastname = $data['LAST'];
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="right"><img src="img/banner_upload.jpg" width="300" height="50"></div></td>
</tr>
<tr>
<td><p align="center"><?php echo $style1."<b>Welcome ".$data['LAST']; ?></b><br>Please try to keep the Kb size low.<br>Thanks, AV8 Airlines.<br>
<form enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<div align="center">
<input type="hidden" name="pass" value="<?php echo $pass; ?>">
<input type="hidden" name="MAX_FILE_SIZE" value="2048000">
File:
<input name="userfile" type="file" />
<input name="submit" type="submit" value="Upload" />
<p></p>
</div>
</form>
<div align="center">
<?php
if (@is_uploaded_file($_FILES["userfile"]["tmp_name"])) {
// echo $_FILES["filename"];
copy($_FILES["userfile"]["tmp_name"], "upload_pic/" . $_FILES["userfile"]["name"]);
echo "<p>File uploaded successfully.</p>";
// $phurl = "http://free.hostultra.com/~av8airlines/upload_pic".$_FILES;
// $phdate = date("d-m-Y");
// $put_data = "INSERT INTO photos (phurl, phdate, phsub) VALUES ('$phurl', '$phdate', '$lastname')";
// mysql_query($put_data);
}
// $getpics = "SELECT * FROM photos WHERE phsub = '$lastname'";
}
?>
<a href="#" onClick="MM_openBrWindow('upload_pic/','Pictures','toolbar=yes,scrollbars=yes,width=600,height=400')">View picture folder</a> </div></td>
</tr>
</table>
<br>
<p align="center">
Thanks in advance.