FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


HomeWatched TopicsRegisterSearchDirectory
FAQMemberlistUsergroupsLog inStoresItemsBank
Google

Reply to topic Page 1 of 1
Curl Upload problem
Message  

Reply with quote
Post Curl Upload problem 
Hi All,

I want to upload my txt file using curl file upload. Its not working properly. I used Mozilla Live Http header but i was no luck. Seems all fine.. i need the solution very urgently..

My porblem is ...

How to upload file using culr.. this is code i am using:

$httpheaders[]="Authorization: Basic $auth";
$httpheaders[]="Content-Type: text/xml";
$httpheaders[] = "FileFormat: TabDelimited";
$filePath = 'TOOLS.TXT';
$postParams = "@$filePath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); // set URL
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch,CURLOPT_POSTFIELDS,$postParams);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return result in a variable
curl_setopt($ch, CURLOPT_HEADER, 1); // include headers in result
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheaders); // send my headers
$postResult = curl_exec($ch);

if (curl_errno($ch))
{
print curl_error($ch);
print "<br>Unable to upload file.";
exit();
}
curl_close($ch);
echo "<pre>$postResult</pre>";

This script is not working fine..

Please help me out Smile

View user's profile Send private message

Reply with quote
Post  
Eh, I've never seen anything like this, but for one, the post parameters has to be in an array, value=>key.

I suppose you could do the following, presuming that file was the name of the file upload (based on the actual upload form):
Code:

$postparams = "file=".get_file_contents($filePATH);


Then again, I'm just throwing ideas out here. There's also another alternative.
However, it involves client-side interaction.

http://curl.haxx.se/libcurl/ph...rtpost.php

View user's profile Send private message
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  



Google

FireFox! The PHP Forum Loans and Credit
Panama Web Design for Hire Free Insurance Quotes!
Web Hosting Advertise Here $10 a Month Designer Children
Never Pay Taxes Again HGH Domain name registration
Web Hosting and Dedicated Servers Insurance Affordable web-hosting


Web Design by PlatinumShore.com & Web Hosting by TradeWebHosting.com