Re: delete and recreate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9 Nov 2011, at 15:35, Kirk Bailey wrote:
> So, I want to create a script to delete an old file and create a new one which is empty. The script receives a password via query string. The obvious methods give me back a very useless 500 error. Any suggestions on how to accomplish what I seek?


First of all you need to sort out your development environment. Getting a 500 response from the server suggests that your server is set up to hide PHP error messages from you. Are you, perchance, using Windows? I don't know what you need to tweak to get it to show you PHP errors but others here may be able to help you with that.

As far as your task goes it seems pretty straightforward. Use unlink() to delete the existing file if file_exists() returns true, then use touch() to create the new, empty file. Simples.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux