Jump to content

Using chdir over a network


Jurik

Recommended Posts

Hi people im currently trying to get my php script to go to another folder on another server and then to delete a file from that folder. Before I simple used chdir to move from a folder that was located with my php script but since putting it over a network I simple cant get to to go to the folder. At the moment I have

chdir ('\\PCnameonnetwprk\\thefolder\\');

This does not seem to work however can anyone help me?
Link to comment
Share on other sites

hhhmmm no im still getting

Warning: chdir(): No such file or directory (errno 2) in location of file on line 29

its strange because I can add a file to the address no problems, it just cant seem to go to the address when deleting.

Any ideas?
Link to comment
Share on other sites

[quote author=HuggieBear link=topic=111757.msg453046#msg453046 date=1161082830]
I didn't realise the single quotes... Try this sorry...

[code=php:0]chdir("\\\\PCnameonnetwprk\\thefolder\\");
[/code]

or this:

[code=php:0]chdir('\\PCnameonnetwprk\thefolder\');
[/code]

Regards
Huggie
[/quote]

hhhmmm that dont seem to work either, this is strange. If I use the top one I get the same error, if I use the one below it I get a parse error.
Link to comment
Share on other sites

Sure here it is, it worked before when I changed the directory to a folder called videos that was in the same folder as my php files its only over the network it dont seem to work.

[quote]<?php

if (isset($_GET['ID'])) {
  $vidID = $_GET['ID'];
} else {
  $vidID = NULL;
}
$query = "SELECT * FROM videos WHERE ID = ('$vidID')";
$result=mysql_query($query);
while($row=mysql_fetch_array($result))
{
  extract($row);
  chdir ('//benin/videolibrary/');
  unlink($Videofile);
}

$query2 = "DELETE FROM videos WHERE ID = ('$vidID')";
$result2 = mysql_query($query2);


echo "The video has been deleted.";

?>[/quote]

chdir ('//benin/videolibrary/'); has been fiddled with so it anit the same as before just been trying to get it to work really thanks for the help tho
Link to comment
Share on other sites

[quote author=craygo link=topic=111757.msg453092#msg453092 date=1161090339]
It is most likely a permission problem and not a problem with your code. Try maping the directory you want and connect to it with a drive letter. I think you will still get the same error but worth a shot.

Ray
[/quote]

Yes I have done that and am still getting the same error code, I mapped it to the drive letter V: and so changed the code to V:\ that didnt work and nor did V:\videolibrary so you delieve it is a permission problem then, will I have to set the permission in the code or can I go it on the server, im guessing I can seeing as how im able to save to the driv with my add script
Link to comment
Share on other sites

On my network here at work, and as I understand it, also microsoft networks, you have to set the internet user, which in IIS is IUSR_[i]computername[/i]. This user has to be added to the target machine for access to it. Since I didn't have access to permissions on the target machine on my network I change the internet user on my computer to my account and everything worked fine. Everything with php uses the default user to access any recourse on the computer and network. So that user has to have proper permissioms.

I am not sure if you are using apache or not, but you may need to do the same. I do not know apache so someone else may be able to help.

Ray
Link to comment
Share on other sites

Well ive asked the guy at work and he says there shouldnt b any problems with permissions as they are all set. I can delete a file manualy from the space im trying to delete from it just seems to be my php that just cant seem to delete anything from. Hes mentioned ones running off a Linux would that be whats causing the problem?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.