MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
Last edited by firepages; 11-14-2012 at 08:18 AM..
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
Last edited by firepages; 11-15-2012 at 12:52 AM..
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
Thank you very much....now we have a php file which makes the copy of all images..this was a great help for me..
If I am not taking your time much, I want to ask your idea about the unsolved part of the solution as well..
Now I am triggering this php file manually by browser or I can make a cron job for every minute..
But both of them are not good solutions, because
1)If there is no change (new upload according to the dedected motion) in camera image file, it is useless to save a copy of image in every minute
2)And also, in one minute there can be 10 different uploads but I can catch and copy only 1 image in this time period by this way
So is there any other ways possible to run this php triggered by every new uploads, or is it impossible to do that?
So is there any other ways possible to run this php triggered by every new uploads, or is it impossible to do that?
not impossible but would require root access to your server & it ain't straight-forward, it requires inotify-tools on linux so perhaps google for that if you are feeling brave
The obvious alternative is CRON, add to your crontab ... check the php path with `which php` /usr/bin/php -q /full/path/to/yourscript.php
I am not sure how your images get put on the server, perhpas your cameras have some notify action ? possibly they can send an email or call a webpage when they save the image... need more info there though.
as for not saving the same image file several times you could use md5_file() to generate a hash of the last image moved, save that somewhere (db or text-file) then check the md5() of the image to make sure it has changed b4 you do your next move?
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
I see. For entering inotify-tools on linux I don't think so I am brave enough
About md5_file() , I think I understand your point, php file will check this information every time before saving a new file and if it is the same file it will not save..right?
I can guess that it is easy script for you, but it seems a little bit advanced programming for me
I am using iSpy security software for uploading image files, uploads on motion detection, but I couldn't find sending email or caling a web page function paralel with upload..
But I can ask an easier script help from you maybe be the solution of this problem.
If we can modify the current code for saving the image files every hour to a new created folder instead of one stable folder, then it can be possble to manage many saved files.
I mean for every day one parent folder of the day will be created automaticly by php file if it is the first file saving after 12:00 am of previous day. Folders as below
121116
121117
121118
.......
And in each folder, 24 folders will be created one by one by php file when the time comes to save an image if file belongs to a new hour, as
00
01
02
04
....
...
22
23
Is it an easy and short modification or difficult and long?
But I need the file will be backed up triggered by every new upload.
How is the file uploaded? - FTP or a HTTP upload?
If its FTP then the most you're going to get is a cycling script that cycles for say 59 seconds before quitting and being restarted by a cron.
If you have total control of the system and can run scripts indefinitely then you could write a service that will just run continually checking for new files and saving them otherwise you're stuck with the 59 seconds and a new cron instance scenario.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
Most servers have a php script maximum execution time of either 30 or 60 seconds. Now if you have a 60 second max then you could easily loop a script for 59 seconds (with a sleep between each loop to stop your host shutting you down for CPU hogging). That means that every time the script loops it will check for any files in directory A and copy them into directory B with a new name.
On the 60th second your cron triggers a new version of the script to run and the whole process starts again for another 59 seconds.
If you're unsure of how to set this up, I can do the initial checks of your environment for you (checking max exec time etc) to see if its suitable but if you want the code written by me it would be chargeable.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.
If that code is that much complex to be chargable I will not try that way. Because this thing which I am trying is a completely amateur effort for me, and the purpose of posting in this forum is for seeking some simple and amateur helps only. Thank you.
In any way, I wonder about is it possible that php script can understand a new file is uploaded while looping? Is it about using the same technique related with md5_file() which "firepages" told in previous posts?
If that code is that much complex to be chargable I will not try that way. Because this thing which I am trying is a completely amateur effort for me, and the purpose of posting in this forum is for seeking some simple and amateur helps only. Thank you.
Don't be put off. It isn't overly complex so it's within your grasp, I was just offering to get you up and running asap for a fee (I've been out of work for 2 years so can't blame me for tryin eh?).
Quote:
Originally Posted by damlays
In any way, I wonder about is it possible that php script can understand a new file is uploaded while looping? Is it about using the same technique related with md5_file() which "firepages" told in previous posts?
Yes. It would be able to recognise a different file to the last one by checking the MD5 as firepages suggests. An MD5 checksum is basically a 32bit string comprising of letters and numbers which is basically generated through voodoo and creates a digital fingerprint of a file. It's extremely rare for two files to ever share the same MD5 so that is how you could determine if the file is the same or different to the last one moved. Either way, assuming you're moving the file from A=>B then it would no longer be at the source anyway so ths script would just look for new files and move them.
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value.