Remote file access

Discussion in 'PHP' started by vivsriaus, Jan 10, 2006.

  1. #1
    Hey all,

    I'm in a fix and am not able to solve this problem!

    I have a file located on a server machine and I wanna read that file!

    the server name is server.safl.umn.edu

    and, if I specify this $file = '\\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat'; $fp = fopen($file,"r")

    it gives me the following error

    Warning: fopen(\server.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat) [function.fopen]: failed to open stream: No such file or directory in C:\websites\techtest.safl.umn.edu\Vivek\demo3.php on line 54

    The access permission settings are perfect, but it just doesnt work!
     
    vivsriaus, Jan 10, 2006 IP
  2. TMan

    TMan Peon

    Messages:
    126
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Vivsriaus, welcome to DP.

    I believe the problem is that you aren't giving an absolute URL to the file. Try using $file = "c:\websites\techtest.safl.umn.edu\common\cellis\safl weather\saf_wthr.dat", if this is the asbolute path of course.
     
    TMan, Jan 10, 2006 IP
  3. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #3
    I have no experience with php + windows + remote access, but you might want to check you back slashes.

    try

    $file = '\\\\server.safl.umn.edu\\common\\cellis\\safl weather\\saf_wthr.dat'; $fp = fopen($file,"r")

    good luck
     
    frankm, Jan 10, 2006 IP
  4. vivsriaus

    vivsriaus Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hey pals,

    Thnx for the replies!
    I tried everything! givin the full path as well as addin more escape characters!
    but, in vain!
    Am not sure wht is happening:confused:
     
    vivsriaus, Jan 10, 2006 IP
  5. TMan

    TMan Peon

    Messages:
    126
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You probably should supply us with additional error messages. Have you checked if the file even exists?
     
    TMan, Jan 10, 2006 IP
  6. dave487

    dave487 Peon

    Messages:
    701
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Are spaces allowed in the "safl weather" part?

    You could try urlencode to make sure it is formatted OK
     
    dave487, Jan 10, 2006 IP
  7. TMan

    TMan Peon

    Messages:
    126
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #7
    He shouldn't have to do that if it's a local file he's trying to access...
     
    TMan, Jan 11, 2006 IP
  8. vivsriaus

    vivsriaus Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    i made the file http readable and got it working!:)
    Thnx for ur suggestions!
     
    vivsriaus, Jan 11, 2006 IP