Results 1 to 3 of 3

Thread: Help with file opening

  1. #1
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Help with file opening

    Can someone tell me if there's an issue with Verio regarding relative links on its servers or if I'm just doing something amazingly stupid.

    I'm trying to pull calendar data from a CSV file. My PHP code works on an extra domain that I'm using as a test site through GoDaddy but I'm having no luck using the same file on a Verio server.

    The relative link that works on my test site includes the line:
    $handle=fopen('calendar/staffCalendar.csv', 'r');

    On Verio, that line results in a Can't Open File error.

    I've discovered a workaround by using an absolute link, but I'd rather keep it relative. The absolute link that works is:
    $handle=fopen('http://www.girlscoutsjs.org/calendar/staffcalendar.csv', 'r');

    The file that contains the link is located in the index directory and the calendar directory is immediately off of that.

    Thanks for any help that anyone can provide.

  2. #2
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I think the problem is that the file you are trying to open is not in the same directory. If it is one directory above, the link would be ../staffCalendar.csv. I am not sure where exactly you have the 2 files, but if the file calling staffCalendar.csv is in the index directory and the staffCalandar file is in the /calendar directory, I believe the link should be /calendar/staffCalendar.csv. Hope that helps
    Thanks DD, you saved me countless times

  3. #3
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Titan85 View Post
    I think the problem is that the file you are trying to open is not in the same directory. If it is one directory above, the link would be ../staffCalendar.csv. I am not sure where exactly you have the 2 files, but if the file calling staffCalendar.csv is in the index directory and the staffCalandar file is in the /calendar directory, I believe the link should be /calendar/staffCalendar.csv. Hope that helps
    I put everything into the same directory, which works around the issue. I tried all the different variations of the directories without any success. If I can get it working in one directory I'm willing to live with it. Thanks for the help.

    The newest issue is that I can't get the file open for writing. I'm using
    $handle=fopen('staffcalendar.csv', 'a');

    Everything is in the same directory, so I shouldn't need to worry about paths. Since this is working without problem on another server with the same directory structure my only thought is that I need to create a php.ini file and allow fopen to open files for writing. I don't know what the command would beor where php.ini would be saved. php_info tells me that the file is saved in "c:\php\php.ini" but that doesn't do me any good.

Bookmarks

Posting Permissions

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