Ah, my fault, I misread that line of code... it does look like you are setting CULROPT_FILENAME, but I don't think that does what you are wanting it to do from reading http://us3.php.net/manual/en/function.curl-setopt.php -Chad
On Tue, Jan 6, 2009 at 1:44 PM, Chad Etzel <[email protected]> wrote: > It looks like you are submitting the actual string > "http://up.jamesnweber.com/Whe.jpg" as the value of $image, whereas I > believe you need to actually send the image file data (i.e. the binary > image data) in the request instead. I have not done this before, so I > am not sure about what encoding to use, but I'm pretty sure that's the > initial problem. > > Anyone else confirm? > -Chad > > On Tue, Jan 6, 2009 at 12:01 PM, James N. Weber <[email protected]> wrote: >> >> I'm trying to develop a web site form that allows you to choose a >> profile picture, enter your username&password, and then it will change >> your profile pic to the selected one. I haven't implemented the >> choosing of the picture yet, as I'm still trying to get one picture to >> go through. I keep getting the error "There was a problem with your >> picture. Probably too big." >> >> Here's the code I have so far- >> >> >> <html><head><title>Title</title> >> <?php >> $username = $_POST["username"]; >> $password = $_POST["password"]; >> $image = $_POST["image"]; >> if (!isset($_POST['submit'])) { // if page is not submitted to itself >> echo the form >> } else { >> // The twitter API address >> $url = 'http://twitter.com/account/update_profile_image.xml'; >> $curl_handle = curl_init(); >> curl_setopt($curl_handle, CURLOPT_URL, "$url"); >> curl_setopt($curl_handle, CURLOPT_POST, 1); >> curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array('Expect:')); >> curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1); >> curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2); >> curl_setopt($curl_handle, CURLOPT_FILE, "ima...@$image;type=image/ >> jpg"); >> curl_setopt($curl_handle, CURLOPT_USERPWD, "$username:$password"); >> $buffer = curl_exec($curl_handle); >> curl_close($curl_handle); >> echo $buffer; >> echo $image; >> } >> ?> >> >> >> >> </head> >> <body> >> >> <form method="post" action="<?php echo $PHP_SELF;?>"> >> Username:<input type="text" size="12" maxlength="12" >> name="username"><br /> >> Password:<input type="password" size="12" maxlength="36" >> name="password"><br /> >> <input type="hidden" value="http://up.jamesnweber.com/Whe.jpg" >> name="image"> >> <input type="submit" value="submit" name="submit"><br /> >> </form><br /> >> >> >> Any ideas? Thanks! >> >
