Hi all,
I cobbled together a form that calls a script to upload pictures to a website. The script was working well until I tried to put it up online.
Apparently the hosting company my client uses wont allow the POST method.
Could someone show me how to rewrite my script as to use GET instead of POST?
Heres the simple form
[code]
<form enctype=”multipart/form-data” action=”addindextop.php” method=”GET”>
<input type=”file” name=”photo” />
<input type=”submit” value=”Upload” />
</form>
And heres the script
[code]
<?php
error_reporting (E_ALL ^ E_NOTICE);
//This is the directory where photos will be saved
$target = “indextop/”;
$target = $target . basename( $_FILES[‘photo’][‘name’]);
//This gets all the other information from the form
$photo=($_FILES[‘photo’][‘name’]);
// Connects to your Database
include’db_connectcm.php’;
//Writes the information to the database
mysql_query(“INSERT INTO `indextop`(indexphoto) VALUES (‘$photo’)”);
//Writes the photo to the server
if(move_uploaded_file($_FILES[‘photo’][‘tmp_name’], $target))
{
//Tells you if its all ok
echo “The file “. basename( $_FILES[‘uploadedfile’][‘name’]). ” has been uploaded, and your information has been added to the directory”;
header(“location: index.php”);
}
else {
//Gives and error if its not
echo “Sorry, there was a problem uploading your file.”;
}
?>
Ive been stuck on this for a while now. Im sure its something simple and any help would be greatly appreciated!
EDIT: It appears ive been wrong.
Aparently this error occurs when trying to POST to a HTML file but the script im calling is actually named .php, Any ideas why im getting this error?
Thanks