Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

PHP and Excel upload

  • 07-05-2008 02:02PM
    #1
    Registered Users, Registered Users 2 Posts: 467 ✭✭nikimere


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


  • Posts: 146 ✭✭ Simon Wet Granule


    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