I owe you guys a beer. This really helped!

On Jan 6, 4:26 pm, "Chad Etzel" <[email protected]> wrote:
> We figured this out off-list, but I'm posting the fix for completeness:
>
> For some reason $newfilename was missing a "." in the filename before "jpg".
>
> try tweaking this line:
> $newfilename = substr($tmpfilename, 0, strlen($tmpfilename) -
> strlen($ext))  . $ext;
> to
> $newfilename = substr($tmpfilename, 0, strlen($tmpfilename) -
> strlen($ext))  . "." . $ext;
>
> That seemed to fix it for James.  Not sure why the code acted
> differently on my server and his, but we got it working for him this
> way.
>
> -Chad
>
> On Tue, Jan 6, 2009 at 4:05 PM, James N. Weber <[email protected]> wrote:
>
>
>
> > Chad- Thanks for all your help with this! I downloaded it from
> > pastebin, and then uploaded it to my server, no changes. It is giving
> > me the "There was a problem with your picture. Probably too big."
> > error still, with several photos. Any ideas what's going on?
>
> > On Jan 6, 1:31 pm, "Chad Etzel" <[email protected]> wrote:
> >> So after some fiddling with your code, I got it to work:
>
> >> I think part of the problem was that you can't use URLs to the image
> >> (like you were doing).
>
> >> Anyway, the following code (see pastebin link) gives examples of how
> >> to do it with File Uploading through a form, or just using canned
> >> local images from your server.
>
> >>http://pastebin.com/f6eb4650c
>
> >> Hope this helps,
> >> -Chad
>
> >> On Tue, Jan 6, 2009 at 3:15 PM, Stuart <[email protected]> wrote:
>
> >> > 2009/1/6 James N. Weber <[email protected]>:
>
> >> >> Thanks for the help, Chad. I think I need the PHP equivalent of -F in
> >> >> curl- I'm not sure how to set that.
>
> >> >> I tried changing it to CURLOPT_POSTFIELDS, and Twitter gave me a
> >> >> "Something is technically wrong." page- the robot lobster with a
> >> >> broken claw.
> >> >> Any ideas?
>
> >> > The code I took the below line from is not uploading an image to
> >> > Twitter, but rather between two internal servers on one of the sites I
> >> > maintain and it works fine for me...
>
> >> > curl_setopt($ch, CURLOPT_URL, $url);
> >> > curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));
> >> > curl_setopt($ch, CURLOPT_POST, 1);
> >> > curl_setopt($ch, CURLOPT_POSTFIELDS, array('img' => '@'.$filename));
> >> > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> >> > $result = curl_exec($ch);
>
> >> > Hope it helps you.
>
> >> > -Stuart
>
> >> > --
> >> >http://stut.net/

Reply via email to