I have created a page in the wordpress site which takes a file as input and posts it to server. In the server the image is moved to the destined location.
The form looks like this
I am unable to track where does the post send the file in the server and it does not even move the code to the destined location.
The action file looks like this
Can someone help? It was working fine in the localhost though. i have checked the permissions as well. The user has write permissions.
The form looks like this
Code:
<form enctype="multipart/form-data" action="http://bytes.com/add.php" method="POST"> Photo: <input type="file" name="photo"><br> <input type="submit" value="Add"> </form>
The action file looks like this
Code:
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Add.php</title> </head> <body> <?php
//This is the directory where images will be saved
$target = dirname(__FILE__) . '/';
echo "Dir name = ".dirname(__FILE__) ." is <br>";
$target = $target. basename($_FILES['photo']['name']);
//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['photo']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
// Gives and error if its not
echo "<br> Sorry, there was a problem uploading your file.";
}
?> </body> </html>
Can someone help? It was working fine in the localhost though. i have checked the permissions as well. The user has write permissions.