Issue regarding Files transfer in wordpress to server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • write2prasi
    New Member
    • Feb 2013
    • 1

    Issue regarding Files transfer in wordpress to server

    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

    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>
    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



    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.
    Last edited by Rabbit; Feb 9 '13, 04:55 AM. Reason: Please use code tags when posting code.
Working...