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

html form problem

Options
  • 07-12-2011 10:32pm
    #1
    Closed Accounts Posts: 183 ✭✭


    Hi all,

    I'm having a problem with a html form. The form is simple...

    <form action="submit.php" method="post"
    enctype="multipart/form-data">

    <input type="file" name="file" id="file" />

    </form>
    submit.php is a page which then uploads the file. In windows this works a treat. However, in some firefox versions (particularly on macs) instead of posting submit.php on the end and going to that page, it prompts the user to download submit.php instead....

    Any ideas?

    Thanks


Comments

  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    How are you hosting the PHP script? I may be wrong but I seem to remember that if the server isn't configured right so that the browser doesn't interpret the PHP script as needing to be handled differently from plain text it'll just go ahead and treat the script as plain text.


  • Closed Accounts Posts: 183 ✭✭pvt6zh395dqbrj


    Hi

    Thanks for your reply. If that were the case, it would mean the php script wouldn't work on any machine right? But in my case - its only firefox on macs where it doesn't work...


    Thanks


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    The PHP is server side, the browser knows nothing about it. It only displays the HTML it sees.

    It may be that it's sending you the page in the wrong file encoding and the browser doesn't know how to interpret it.

    Also make sure the correct content type is specified in the header.
    Try doing this on the very first line of your PHP script:
    [php]
    <?php header('Content-Type: text/html'); ?>
    [/php]


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    Hi

    Thanks for your reply. If that were the case, it would mean the php script wouldn't work on any machine right? But in my case - its only firefox on macs where it doesn't work...


    Thanks
    And that's why I'm asking how you've got it hosted. Yes, if you're accessing http://www.myserver.com/test.php on PC and Mac it shouldn't make any difference but if you're doing something else e.g. hosting it locally on both then there could be a configuration issue.


  • Closed Accounts Posts: 183 ✭✭pvt6zh395dqbrj


    Hi,

    Thanks for the reply. It turns out the problem was with something completely unrelated to the html form, it was a bug in the submit.php file.

    Thanks!


  • Advertisement
  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    Glad you got it sorted!


  • Registered Users Posts: 26,574 ✭✭✭✭Creamy Goodness


    `php -l filename`

    is your friend to catch syntactical errors (if this was indeed one) :pac:


Advertisement