Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    File not uploaded

    File not uploaded
    I have written a simple php code to upload a file . There is no error when I run the code but file is not uploaded in the specified directory.

    PHP Code:
    PHP Code:
    <?php

            
            $dir
    ="\uploadedFile";

            foreach(
    $_FILES as $filename => $filearray )
            {
            
            
            echo 
    $filearray['tmp_name']."<br>";
            echo 
    $filearray['name']."<br>";
            echo 
    $filearray['size']."<br>";
            echo 
    $filearray['type']."<br>";
            
            if( 
    is_uploaded_file($filearray['tmp_name'] )  )
            {
            
    move_uploaded_file$filearray['tmp_name'] ,    "$dir\$filearray[name]"  );
            
            echo 
    " file is uploded<br>";
            
            }
            
            }
            
            
    ?>
    my html form code is as follws-
    HTML Code:
    Code:
    <body> <form action="fileupform.php" enctype="multipart/form-data" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="51200"> <input type="file" name="fileupload"> <p> <input type="submit" value="upload" > </p> </form> </body>
    I hav made a directory named uploadedFile in htdocs folder. The name as specified for the destination directory.Everything goes well but the file is not there in the directory. PLs help me.
    Last edited by tanvirtonu : Today at 04:30 AM.
    Edit/Delete Message Reply With Quote Quick reply to this message

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    $dir\$filearray[name]?
    Use forward slash(/) to separate directories/file
    Code:
    $dir/$filearray[name]
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •