CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2007
    Posts
    72

    Question Need a little assist with some php...

    I have a security camera that I want the JPGs courtesy of Fwink kept off site...

    Although apparently I am getting rusty with php...

    I tried
    Code:
    <? php
    if(time() >= file_get_contents('time.txt')+10){
    	$a = 'camshots/' . date('y') . '/' . date('m') . '/' . date('d') . '/' . date('H.i.s') . '.jpg';
    	copy('camshots/webcam.jpg',$a);
    	file_put_contents('time.txt',time());
    }
    ?>
    That created a file in the main directory that looked sorta like "camshots/10/09/16/5.10.55.jpg"

    So I tried adding
    Code:
    	if(!file_exists('camshots/' . date('y') . '/' . date('m') . '/' . date('d') . '/'))
    		mkdir('camshots/' . date('y') . '/' . date('m') . '/' . date('d') . '/' );
    before the copy code however that just made the script non responsive...

    Any suggestions?
    Better methods?
    Leaner code to do it?

    Thanks in advance

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Need a little assist with some php...

    Create a global variable for the actual directory. Then you can constantly access one defined variable throughout the script.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured