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 5 of 5
  1. #1
    Regular Coder
    Join Date
    May 2008
    Posts
    446
    Thanks
    23
    Thanked 5 Times in 5 Posts

    file_put_contents() not working in IE9 only

    I am trying change a file with name exactly the same as a email address. Just meaning to add a small snippet of text to it via ajax call with jquery .get().

    So far it works great in Chrome and FF but IE9 is not working file_put_contents() function only, Ajax fires no problem.

    Another oddity is that after doing the file_put_contents() in IE9, I imediatly do a file_get_contents to check if the message was sent successfully. IE9 returns the message I want it to save, but inspecting the file itself shows nothing has changed!?

    Here is my code:
    PHP Code:
        $emailFileName trim($email);
        
        
    $status 'new message';
                
            
    $filePutResult file_put_contents($emailFileName$status);
            
            echo 
    $emailFileName.'\'s status has been set to: '.$status.' ...and this many bytes were written to the file: '.$filePutResult.'<br />';
            
            
    $fileGetResult file_get_contents($emailFileName);
            
            echo 
    $emailFileName.'\'s status really is: '.$fileGetResult
    Any thoughts? I appreciate the help

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    php works the same no matter what browser you're using. It's a serverside language, not clientside.

  • #3
    Regular Coder
    Join Date
    Jan 2009
    Posts
    193
    Thanks
    0
    Thanked 20 Times in 20 Posts
    Are you getting any error messages (check server logs if you have access)? How much data is being passed via ajax?

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,091
    Thanks
    51
    Thanked 506 Times in 493 Posts
    I don't suppose you're looking for the submit button in your code? (like the code sample in my signature)

    If you are then you need to read the link in my signature as this is classic IE behaviour not to submit the button and cause scripts not to work as expected.
    My helpful sig is on vacation trying to loose some weight. It got a bit fat and caused a few problems but it will be back at some point!

  • #5
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,472
    Thanks
    0
    Thanked 634 Times in 624 Posts
    GET requests are supposed to return the same result from multiple calls so browsers are allowed to cache the result for reuse if the same call is made again. IE is one of the browsers that is more efficient by actually what it is allowed to in that situation.

    If you expect the data to change between calls you need to use POST.

    That's the main difference between what GET and POST actually do (everything else is cosmetic).
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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