2 Easy Questions(I Think!)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nparekh
Forum Commoner
Posts: 31
Joined: Fri Aug 05, 2005 2:35 am

2 Easy Questions(I Think!)

Post by nparekh »

Hi guys

Firstly thanks for all who have helped me here - made tasks so much easier! :)

Now I have some php code on my server which takes a bunch of text files and saves it to a directory on the server.

Code: Select all

if (is_uploaded_file($_FILES['words']['tmp_name'])){
            move_uploaded_file($_FILES['words']['tmp_name'],$SCRIPT_PATH."task_$suffix/words.txt");
What I would like to do is make two copies of these files. One to be saved in the directory listed above and another to a test folder

- test_$suffix/words.txt

How do I get a copy saved? I can't seem to get it to work

The other question I have is how can I get a cron job to run every 7 seconds? At present I'm only able to run it every 1 minute.

Thanks in advance!

Nikhil
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

1. Duplicate the moved_uploaded_files line and change the directory name.

2. Cron is built to run every minute so that's not possible.

I suggest redesigning your script or using something like sleep(7) and then header($path_to_self)
nparekh
Forum Commoner
Posts: 31
Joined: Fri Aug 05, 2005 2:35 am

Post by nparekh »

Hi Sami

Thanks for replying.

1) I fixed the uploading of files to two directories so that works great:)

2) I'll have to investigate the sleep command - there might be a way to make the php script run a few times in a minute. I'll get my friend to look at it:)

Thanks in advance!!

Regards,

Nikhil
Post Reply