# Php touch??



## CF128 (Jul 4, 2004)

The PHP function touch() doesn't work for me. It says it's unable to create file because no such file or directory. Isn't that the point of the function. You 'touch' a file that doesn't exist and it will make it for you 

Anyone... help??


----------



## namenotfound (Apr 30, 2005)

http://us3.php.net/touch


----------



## CF128 (Jul 4, 2004)

That's absolutely no help. I know what touch is meant to do, its just not doing it.


----------



## CF128 (Jul 4, 2004)

Okay I figured it out. You need to set the permissions in the directory that the 'touched' file is in (or not in, because you're going to create the file by touching it) to enable 'writing' for 'other/everyone'.


----------



## CF128 (Jul 4, 2004)

Actually no, that didn't fix the problem.


----------



## CF128 (Jul 4, 2004)

Okay I was using touch("http://www.site.com/directory/image.jpg"). However if I use the relative location of the file - touch('directory/image.jpg') - it works.


----------



## namenotfound (Apr 30, 2005)

r_sole said:


> Okay I was using touch("http://www.site.com/directory/image.jpg"). However if I use the relative location of the file - touch('directory/image.jpg') - it works.


Which is exactly what you could have read from the link I gave you 

(note: reading the comments on any php.net page is always a good thing)

If you read the comment by "guy at forster design dot com", he said to use a path (which is what you eventually did). 

Glad you got it working


----------



## CF128 (Jul 4, 2004)

namenotfound said:


> (note: reading the comments on any php.net page is always a good thing)


I shall do from now on.

Thanks dude :up:


----------

