Re: Converting CGI+Perl to PHP Help

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

 



Hi , 

I just for test my program is working or not I write every thing in the file  . when the camera send the image automatically I am making one txt file and writing every think I that . Now all time this txt file will coming to the server and information in side of that is 



Host = 192.168.11.40
User-Agent = Axis shttpclient $Revision: 1.45 $
Content-Type = image/jpeg
Content-Disposition = attachment; filename="image.jpg"
Content-Length = 46760


The code I put in the file is like this :
_____________________________________________________

<?php
$uploaddir = $_SERVER["DOCUMENT_ROOT"] . '/test/live/';
$uploadfile = $uploaddir .$_FILES['FileName']['name'];
$myFile = $_FILES['FileName']['name'].".txt";
$fh = fopen($uploaddir.$myFile, 'w') or die("can't open file");




foreach (getallheaders() as $name => $value) {
   print($name."=". $value);
   $stringData = "$name = $value\n";
   fwrite($fh, $stringData);
   echo "<br/>";
}

echo "<pre>"; print_r($_FILES); echo "</pre>";

$stringData = "\t\n".$_FILES." ";
fwrite($fh, $stringData);

if (!move_uploaded_file($_FILES['FileName']['tmp_name'],$uploadfile)) {
    die("Error!\n");
}

fclose($fh);
?>

_______________________________________________


So any suggestion what is wrong . 

with best regards 
Ali 





________________________________
From: Ali Jamali <ali.jamali@xxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx
Sent: Monday, November 24, 2008 9:51:45 PM
Subject: Re:  Converting CGI+Perl to PHP Help


The camera have 3 option to upload picture , I know all of those quite well , I can tell you FTP is very good why but is very slow to sending image to the server . the best way use the TCP /IP but due to the way of access in our network , You can sending images from the camera to server so the TCP/IP also is not useful , The last option and best option for us is use the HTTP_push_server , That mean the camera can send image to one upload file in the server and that file have to write that to the server . 
For this way in them site they have two ready solution . One is the CGI/Perl File which i send to you .Other one is ASP file .
So why I need to change these to PHP ?

1. CGI : Have problem because camera is sending the Image 30 time per secend or min 10 frame per secend . so before cgi file write one file other file is arrived and cgi file half the way of writing the file will cut and starting to write new file . "All time one file name will rewriting " 

2. ASP : ASP one is perfect , every thing is ok in that one . But because my web server is apache , and Apache is not possible to run ASP I can`t use that . I installed one ASP.NET plugin to Apache but if i wanted that ASP still I need to change that ASP to ASP.NET . I try several program to convert ASP to ASP.NET or PHP but I coudn`t get good resulte . 

so I try for that PHP which I send to you . and Camera is shwoing the camera is sending the image but noding is save in my hard disk . "I mean my Server H.D.D " , So still I need somebody help me to solve this problem . 

Thanks 
Ali 

____________ _________ _________ __
From: "Atkinson, Robert" <ratkinson@tbs- ltd.co.uk>
To: php-objects@ yahoogroups. com
Sent: Monday, November 24, 2008 8:54:56 PM
Subject: RE:  Converting CGI+Perl to PHP Help

The manual (http://www.axis. com/files/ manuals/28909. pdf) talks about Event
Servers on page 23. I guess that's what you are using?

"Event Servers

Event Servers are used to receive, e.g. uploaded image files and/or
notification messages. To set up Event server connections in your camera, go
to Setup > Event Configuration > Event Servers and enter the required
information for the required server type.

For details on each setting, please see the online help available from each
web page."

The manual doesn't give any detail about these, but does talk about 'buffers'
(page 24). Have you tried changing this.

I would also suggest changing the upload type to FTP instead of HTTP. At
least you will have more control.

Robert.

-----Original Message-----
From: php-objects@ yahoogroups. com [mailto:php- objects@ yahoogroups. com] On
Behalf Of Ali Jamali
Sent: 24 November 2008 16:34
To: php-objects@ yahoogroups. com
Subject: Re:  Converting CGI+Perl to PHP Help

The Camera Model is AXIS 211W :

Here is the link of  the camera`s website :

http:// www. axis .com /products / cam_211w / index. htm

thanks 
Ali 

____________ _________ _________ __
From: "Atkinson, Robert" <ratkinson@tbs- ltd.co.uk>
To: php-objects@ yahoogroups. com
Sent: Monday, November 24, 2008 4:51:03 PM
Subject: RE:  Converting CGI+Perl to PHP Help

>From what I can see, the ASP code simply takes whatever binary stream is sent
to the server and puts it into the Application buffer ready for use
elsewhere.

The equivalent for PHP is :-
http://uk.php. net/manual/ en/function. getallheaders. php 

However, the fact that you can change the image filename on the camera leads
me to think that you have more options available to you.

Please can you send me the camera model details, so I can look at the user
guide for it.

Rob.

-----Original Message-----
From: php-objects@ yahoogroups. com [mailto:php- objects@ yahoogroups. com] On
Behalf Of Ali Jamali
Sent: 24 November 2008 11:14
To: php-objects@ yahoogroups. com
Subject: Re:  Converting CGI+Perl to PHP Help

Also the same program in ASP is
____________ _________ _________ _________ ___

<%

biData = Request.BinaryRead( Request.TotalByt es)

if len(bidata) > 0 then 

Application( "imageSize" ) = LenB(biData) 
Application( "theImage" ) = biData 

end if

%>
<html>
<body>
File uploaded successfully!
</body>
</html>

____________ _________ _________ _________ _______

************ ********* ********* ********* ********* ********* *********
********* ********
Any opinions expressed in email are those of the individual and not
necessarily those of the company. This email and any files transmitted with
it are confidential and solely for the use of the intended recipient 
or entity to whom they are addressed. It may contain material protected by
attorney-client privilege. If you are not the intended recipient, or a person
responsible for delivering to the intended recipient, be advised that you
have received this email in error and that any use is strictly prohibited.

Random House Group + 44 (0) 20 7840 8400
http://www.randomho use.co.uk
http://www.booksatt ransworld. co.uk 
http://www.kidsatra ndomhouse. co.uk
Generic email address - enquiries@randomhou se.co.uk

Name & Registered Office:
THE RANDOM HOUSE GROUP LIMITED
20 VAUXHALL BRIDGE ROAD
LONDON
SW1V 2SA
Random House Group Ltd is registered in the United Kingdom with company No.
00954009, VAT number 102838980
************ ********* ********* ********* ********* ********* *********
********* ********

[Non-text portions of this message have been removed]

------------ --------- --------- ------

Are you looking for a PHP job? Join the PHP Professionals directory Now!
http://www.phpclass es.org/professio nals/Yahoo! Groups Links

[Non-text portions of this message have been removed]

    


      

[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux