Bluehost.com Web Hosting $6.95

RE: [PHP] How to accept file through http from curl c program??

This is a discussion on RE: [PHP] How to accept file through http from curl c program?? within the PHP General forums, part of the PHP Programming Forums category; Thanks Chris but I don't think that is the issue as the file is being created and the script ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-26-2003
Brian Moynihan
 
Posts: n/a
Default Re: [PHP] How to accept file through http from curl c program??

Thanks Chris but I don't think that is the issue as the file is being
created and the script is running through.

It's just that $_FILES contains no data which it should?? I is confused as
they say because it works perfectly using the browser ...

----- Original Message -----
From: <chris.neale@somerfield.co.uk>
To: <brian.moynihan@3procure.com>; <php-general@lists.php.net>
Sent: Friday, September 26, 2003 12:29 PM
Subject: RE: [php] How to accept file through http from curl c program??


> At a first glance:
>
> $fp=fopen(brianLog1, "w+");
>
> brianlog1 should either be in quotes if that's the name of the file and

the
> file doesn't have an extension. Or maybe it's a variable in which case
> you'll need to put the $ in front of it..
>
> Hope that helps
>
> Regards
>
> Chris
>
>
>
> -----Original Message-----
> From: Brian Moynihan [mailto:brian.moynihan@3procure.com]
> Sent: 26 September 2003 10:25
> To: php-general@lists.php.net
> Subject: [php] How to accept file through http from curl c program??
>
>
> Hi there,
>
> Hopefully someone can shed some light for us on this.
>
> We have a client who is sending us a file through a C program which uses
> Curl. At our end we have a php script to accept the file passed through

the
> form. This php script works fine using a browser however, it does not pick
> up what the C program sends to us.
>
> Our php is below, $_FILES contains zilch!! Any ideas?:
>
> foreach( $_FILES as $varname => $fileinfo ){
> $filename = $fileinfo["name"];
> $tmpname = $fileinfo["tmp_name"];
> }
>
> $uploaddir = '/usr/local/nameofdir/;
> $uploadfile = $uploaddir. $_FILES['filename']['name'];
>
> if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) {
>
> $fp=fopen(brianLog1, "w+");
> $string = "HTTPS POST of Purchase Order SUCCESSFUL.************ File
> Name: ".$_FILE['filename']['name']."\n";
> fwrite($fp, $string);
> }
> else {
> $fp=fopen(brianLog2, "w+");
> $string = "HTTPS POST Failed !************* File Name:
> ".$_FILES['filename']['name']."\nTmp Name: "
> .$_FILES['filename']['tmp_name'];
> fwrite($fp, $string);
>
> }
> ?>
>
> If you are not the intended recipient of this e-mail, please preserve the
> confidentiality of it and advise the sender immediately of any error in
> transmission. Any disclosure, copying, distribution or action taken, or
> omitted to be taken, by an unauthorised recipient in reliance upon the
> contents of this e-mail is prohibited. Somerfield cannot accept liability
> for any damage which you may sustain as a result of software viruses so
> please carry out your own virus checks before opening an attachment. In
> replying to this e-mail you are granting the right for that reply to be
> forwarded to any other individual within the business and also to be read

by
> others. Any views expressed by an individual within this message do not
> necessarily reflect the views of Somerfield. Somerfield reserves the

right
> to intercept, monitor and record communications for lawful business
> purposes.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply With Quote
  #2 (permalink)  
Old 09-26-2003
Chris Neale
 
Posts: n/a
Default RE: [PHP] How to accept file through http from curl c program??

At a first glance:

$fp=fopen(brianLog1, "w+");

brianlog1 should either be in quotes if that's the name of the file and the
file doesn't have an extension. Or maybe it's a variable in which case
you'll need to put the $ in front of it..

Hope that helps

Regards

Chris



-----Original Message-----
From: Brian Moynihan [mailto:brian.moynihan@3procure.com]
Sent: 26 September 2003 10:25
To: php-general@lists.php.net
Subject: [php] How to accept file through http from curl c program??


Hi there,

Hopefully someone can shed some light for us on this.

We have a client who is sending us a file through a C program which uses
Curl. At our end we have a php script to accept the file passed through the
form. This php script works fine using a browser however, it does not pick
up what the C program sends to us.

Our php is below, $_FILES contains zilch!! Any ideas?:

foreach( $_FILES as $varname => $fileinfo ){
$filename = $fileinfo["name"];
$tmpname = $fileinfo["tmp_name"];
}

$uploaddir = '/usr/local/nameofdir/;
$uploadfile = $uploaddir. $_FILES['filename']['name'];

if (move_uploaded_file($_FILES['filename']['tmp_name'], $uploadfile)) {

$fp=fopen(brianLog1, "w+");
$string = "HTTPS POST of Purchase Order SUCCESSFUL.************ File
Name: ".$_FILE['filename']['name']."\n";
fwrite($fp, $string);
}
else {
$fp=fopen(brianLog2, "w+");
$string = "HTTPS POST Failed !************* File Name:
".$_FILES['filename']['name']."\nTmp Name: "
..$_FILES['filename']['tmp_name'];
fwrite($fp, $string);

}
?>

If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield. Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.
Reply With Quote
  #3 (permalink)  
Old 09-26-2003
Mike Brum
 
Posts: n/a
Default RE: [PHP] How to accept file through http from curl c program??

I don't really know much about Curl, but what it -sounds- like is that Curl
isn't sending the proper headers/MIME types to the PHP script and PHP isn't
putting the input into the $_FILES array. You might want to look in your
$_GET or $_POST array for existance of the file to see if it's being sent
there.

Good luck.

-M

-----Original Message-----
From: Brian Moynihan [mailto:brian.moynihan@3procure.com]
Sent: Friday, September 26, 2003 6:44 AM
To: php-general@lists.php.net
Subject: Re: [php] How to accept file through http from curl c program??


Thanks Chris but I don't think that is the issue as the file is being
created and the script is running through.

It's just that $_FILES contains no data which it should?? I is confused as
they say because it works perfectly using the browser ...

----- Original Message -----
From: <chris.neale@somerfield.co.uk>
To: <brian.moynihan@3procure.com>; <php-general@lists.php.net>
Sent: Friday, September 26, 2003 12:29 PM
Subject: RE: [php] How to accept file through http from curl c program??


> At a first glance:
>
> $fp=fopen(brianLog1, "w+");
>
> brianlog1 should either be in quotes if that's the name of the file
> and

the
> file doesn't have an extension. Or maybe it's a variable in which case
> you'll need to put the $ in front of it..
>
> Hope that helps
>
> Regards
>
> Chris
>
>
>
> -----Original Message-----
> From: Brian Moynihan [mailto:brian.moynihan@3procure.com]
> Sent: 26 September 2003 10:25
> To: php-general@lists.php.net
> Subject: [php] How to accept file through http from curl c program??
>
>
> Hi there,
>
> Hopefully someone can shed some light for us on this.
>
> We have a client who is sending us a file through a C program which
> uses Curl. At our end we have a php script to accept the file passed
> through

the
> form. This php script works fine using a browser however, it does not
> pick up what the C program sends to us.
>
> Our php is below, $_FILES contains zilch!! Any ideas?:
>
> foreach( $_FILES as $varname => $fileinfo ){
> $filename = $fileinfo["name"];
> $tmpname = $fileinfo["tmp_name"];
> }
>
> $uploaddir = '/usr/local/nameofdir/;
> $uploadfile = $uploaddir. $_FILES['filename']['name'];
>
> if (move_uploaded_file($_FILES['filename']['tmp_name'],
> $uploadfile)) {
>
> $fp=fopen(brianLog1, "w+");
> $string = "HTTPS POST of Purchase Order SUCCESSFUL.************
> File
> Name: ".$_FILE['filename']['name']."\n";
> fwrite($fp, $string);
> }
> else {
> $fp=fopen(brianLog2, "w+");
> $string = "HTTPS POST Failed !************* File Name:
> ".$_FILES['filename']['name']."\nTmp Name: "
> .$_FILES['filename']['tmp_name'];
> fwrite($fp, $string);
>
> }
> ?>
>
> If you are not the intended recipient of this e-mail, please preserve
> the confidentiality of it and advise the sender immediately of any
> error in transmission. Any disclosure, copying, distribution or action
> taken, or omitted to be taken, by an unauthorised recipient in
> reliance upon the contents of this e-mail is prohibited. Somerfield
> cannot accept liability for any damage which you may sustain as a
> result of software viruses so please carry out your own virus checks
> before opening an attachment. In replying to this e-mail you are
> granting the right for that reply to be forwarded to any other
> individual within the business and also to be read

by
> others. Any views expressed by an individual within this message do
> not necessarily reflect the views of Somerfield. Somerfield reserves
> the

right
> to intercept, monitor and record communications for lawful business
> purposes.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Reply With Quote
  #4 (permalink)  
Old 09-26-2003
Brian Moynihan
 
Posts: n/a
Default Re: [PHP] How to accept file through http from curl c program??

Thanks Mike,

I set the content type to be text/xml in the C program. Just don't
understand it at all. There appears to be no reason why it's not working.

Thanks for your help so far, any more suggestions?

Brian.
----- Original Message -----
From: "Mike Brum" <php@crazyted.com>
To: "'Brian Moynihan'" <brian.moynihan@3procure.com>;
<php-general@lists.php.net>
Sent: Friday, September 26, 2003 1:36 PM
Subject: RE: [php] How to accept file through http from curl c program??


> I don't really know much about Curl, but what it -sounds- like is that

Curl
> isn't sending the proper headers/MIME types to the PHP script and PHP

isn't
> putting the input into the $_FILES array. You might want to look in your
> $_GET or $_POST array for existance of the file to see if it's being sent
> there.
>
> Good luck.
>
> -M
>
> -----Original Message-----
> From: Brian Moynihan [mailto:brian.moynihan@3procure.com]
> Sent: Friday, September 26, 2003 6:44 AM
> To: php-general@lists.php.net
> Subject: Re: [php] How to accept file through http from curl c program??
>
>
> Thanks Chris but I don't think that is the issue as the file is being
> created and the script is running through.
>
> It's just that $_FILES contains no data which it should?? I is confused as
> they say because it works perfectly using the browser ...
>
> ----- Original Message -----
> From: <chris.neale@somerfield.co.uk>
> To: <brian.moynihan@3procure.com>; <php-general@lists.php.net>
> Sent: Friday, September 26, 2003 12:29 PM
> Subject: RE: [php] How to accept file through http from curl c program??
>
>
> > At a first glance:
> >
> > $fp=fopen(brianLog1, "w+");
> >
> > brianlog1 should either be in quotes if that's the name of the file
> > and

> the
> > file doesn't have an extension. Or maybe it's a variable in which case
> > you'll need to put the $ in front of it..
> >
> > Hope that helps
> >
> > Regards
> >
> > Chris
> >
> >
> >
> > -----Original Message-----
> > From: Brian Moynihan [mailto:brian.moynihan@3procure.com]
> > Sent: 26 September 2003 10:25
> > To: php-general@lists.php.net
> > Subject: [php] How to accept file through http from curl c program??
> >
> >
> > Hi there,
> >
> > Hopefully someone can shed some light for us on this.
> >
> > We have a client who is sending us a file through a C program which
> > uses Curl. At our end we have a php script to accept the file passed
> > through

> the
> > form. This php script works fine using a browser however, it does not
> > pick up what the C program sends to us.
> >
> > Our php is below, $_FILES contains zilch!! Any ideas?:
> >
> > foreach( $_FILES as $varname => $fileinfo ){
> > $filename = $fileinfo["name"];
> > $tmpname = $fileinfo["tmp_name"];
> > }
> >
> > $uploaddir = '/usr/local/nameofdir/;
> > $uploadfile = $uploaddir. $_FILES['filename']['name'];
> >
> > if (move_uploaded_file($_FILES['filename']['tmp_name'],
> > $uploadfile)) {
> >
> > $fp=fopen(brianLog1, "w+");
> > $string = "HTTPS POST of Purchase Order SUCCESSFUL.************
> > File
> > Name: ".$_FILE['filename']['name']."\n";
> > fwrite($fp, $string);
> > }
> > else {
> > $fp=fopen(brianLog2, "w+");
> > $string = "HTTPS POST Failed !************* File Name:
> > ".$_FILES['filename']['name']."\nTmp Name: "
> > .$_FILES['filename']['tmp_name'];
> > fwrite($fp, $string);
> >
> > }
> > ?>
> >
> > If you are not the intended recipient of this e-mail, please preserve
> > the confidentiality of it and advise the sender immediately of any
> > error in transmission. Any disclosure, copying, distribution or action
> > taken, or omitted to be taken, by an unauthorised recipient in
> > reliance upon the contents of this e-mail is prohibited. Somerfield
> > cannot accept liability for any damage which you may sustain as a
> > result of software viruses so please carry out your own virus checks
> > before opening an attachment. In replying to this e-mail you are
> > granting the right for that reply to be forwarded to any other
> > individual within the business and also to be read

> by
> > others. Any views expressed by an individual within this message do
> > not necessarily reflect the views of Somerfield. Somerfield reserves
> > the

> right
> > to intercept, monitor and record communications for lawful business
> > purposes.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 04:28 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0