Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP and Excel upload

Options
  • 07-05-2008 3:02pm
    #1
    Registered Users Posts: 467 ✭✭


    Hey lads,

    I'm having a bit of trouble uploading an Excel (.xls) file to my webserver via a form on my site.
    This is a sample script i copied from some tutorial. I just need to be able to upload a files to a directory.
    Nothing too complicated, no need for file validation or any security.

    Here is the HTML code i'm using:
    [HTML]
    <form enctype="multipart/form-data" action="uploader.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    Choose a file to upload: <input name="uploadedfile" type="file" /><br />
    <input type="submit" value="Upload File" />
    </form>
    [/HTML]

    Here is the PHP code:
    [PHP]
    // Where the file is going to be placed
    $target_path = "uploads/";

    /* Add the original filename to our target path.
    Result is "uploads/filename.extension" */
    $target_path = $target_path . basename( $_FILES);
    $_FILES;
    [/PHP]

    It will upload most file types. I've tried it with word (.doc), jpeg, gif and they all work fine. For some reason Excel files wont upload....

    P.S. i know this is an very un-secure script. I'm not worried about that as it is only accessible to admins how have been approved by me.


Comments

  • Closed Accounts Posts: 25 -MrT-


    I would really like to see an answer to this one...


  • Registered Users Posts: 146 ✭✭waynewex


    The code-piece that you're showing us doesn't move the uploaded file?

    Do you have this piece of code further down?

    [PHP]
    $move = move_uploaded_file($_FILES,$target_path);
    if(!$move){
    //success
    }
    [/PHP]


Advertisement