CrazyEngineers
  • Problem in Php script

    Manish Goyal

    Member

    Updated: Oct 19, 2024
    Views: 891
    I am facing a problem in php script ...this script is used to upload a file in server
    Please help me ..here is the script
    <html>
    <head>
    <title>File Upload Form</title>
    </head>
    <body>
    This form allows you to upload a file to the server.<br>
    
    <form action="getfile.php" method="post"><br>
    Type (or select) Filename: <input type="file" name="uploadFile">
    <input type="submit" value="Upload File">
    </form>
    
    </body>
    </html>
    
    This is my home page
    <html>
    <head>
    <title>Process Uploaded File</title>
    </head>
    <body>
    <?php
    
    move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
           "../uploads/{$_FILES['uploadFile'] ['name']}")
    
    ?>
    </body>
    </html>
    
    For this i have a created a directory 'uploads' where i want file to be uploaded
    but when i check there is no file there
    Please help me..Is there any error in script?
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • sarveshgupta

    MemberJan 8, 2010

    <?php

    move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
    "../uploads/".$_FILES['uploadFile'] ['name']);

    ?>
    Goyal See the changes I have suggested in Bold Maybe they are of help

    I am not acquainted with php but I thought this maybe the error so suggested

    Please don't laugh if there is something silly in the changes Hope it helps
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberJan 8, 2010

    Hey I never laugh on others
    because every silly point is also a point
    Thanks for help..but now I got my error actually i have to mention there
    <form action="getfile.php" method="post" enctype="multipart/form-data">
    Thanks again
    Are you sure? This action cannot be undone.
    Cancel
  • wlegend

    MemberJan 11, 2010

    yeah this is it man ,i've had the same problem once with the enctype tag,
    good luck with php
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register