cURL uploading image. It's either gremlins or UFO's

Hi all and welcome to my craziness.
I am trying to upload a logo to Aweber
If I use this path, C:\Users\Public\Pictures\Sample Pictures/whatever.jpg, it works everytime.
If I use this path, C:\web\michael\Dropbox\sites\Sample Pictures/whatever.jpg, it works every time.
This is the crazy part, if I use this path, it fails every time. C:\Users\WiFi Gator\Pictures\2013-10-31/whatever.jpg fails everytime.
I think the problem is that the address bar actually displays “My Pictures”, not “Pictures”.
This is what I get for a successful upload, using,


curl_setopt($curl, CURLOPT_VERBOSE, true);
$verbose = fopen('php://temp', 'rw+');
curl_setopt($curl, CURLOPT_STDERR, $verbose);	

results of a successful upload


Array $_FILES
(
    [logo_upload] => Array
        (
            [name] => wifi1.png
            [type] => image/png
            [tmp_name] => C:\\Windows\\phpE632.tmp
            [error] => 0
            [size] => 68309
        )

)
// Passed to curl post
Array
(
    [sess_token] => b2d545f99cbe1d0a7382e04670d68c719385f690
    [logo_upload] => @C:\\Windows\\phpE632.tmp
)
Array
(
     => https://www.aweber.com/users/settings/logo
    [content_type] => text/plain
    [http_code] => 200
    [header_size] => 514
    [request_size] => 829
    [filetime] => -1
    [ssl_verify_result] => 20
    [redirect_count] => 0
    [total_time] => 5.304
    [namelookup_time] => 0.109
    [connect_time] => 0.281
    [pretransfer_time] => 2.699
    [size_upload] => 68671
    [size_download] => 128
    [speed_download] => 24
    [speed_upload] => 12947
    [download_content_length] => 128
    [upload_content_length] => 68671
    [starttransfer_time] => 2.902
    [redirect_time] => 0
    [redirect_url] => 
    [primary_ip] => 204.194.222.28
    [certinfo] => Array
        (
        )

    [primary_port] => 443
    [local_ip] => 192.168.20.133
    [local_port] => 58759
)
Verbose information:
* Adding handle: conn: 0x9b0d70
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x9b0d70) send_pipe: 1, recv_pipe: 0
* About to connect() to www.aweber.com port 443 (#0)
*   Trying 204.194.222.28...
* Connected to www.aweber.com (204.194.222.28) port 443 (#0)
* SSL connection using RC4-SHA
* Server certificate:
* 	 subject: serialNumber=DWLXYSjpKkFc6y7W/CZYHMq6UG38JteK; C=US; ST=Pennsylvania; L=Chalfont; O=AWeber Systems, Inc.; CN=*.aweber.com
* 	 start date: 2013-01-24 15:55:58 GMT
* 	 expire date: 2015-01-26 20:48:12 GMT
* 	 subjectAltName: www.aweber.com matched
* 	 issuer: C=US; O=GeoTrust, Inc.; CN=GeoTrust SSL CA
* 	 SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> POST /users/settings/logo HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Host: www.aweber.com
Accept: */*
Cookie: AUTORESPSID=b2d545f968c719385f690; AppCookie[cookie_support]=supported; AppCookie[curlis]=loren1408; AppCookie[customer]=1; TS8fba11=70e4b5e7e01c161c971c5befd39dbd1b0f791761e990; TS8fba11_29=a8b505b5204da88bec5a81ca33aca0a9371c5befd23f9261000000000000000000532b2303; cookie_aweber_referrer_id=99
Cache-Control: max-age=0
Connection: keep-alive
Keep-Alive: 300
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip
Content-Length: 68671
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------c954c1b92967

< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Date: Fri, 21 Mar 2014 00:29:09 GMT
* Server Apache is not blacklisted
< Server: Apache
< P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
< Expires: Mon, 26 Jul 1997 05:00:00 GMT
< Last-Modified: Fri, 21 Mar 2014 00:29:11 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Cache-Control: No-Cache
< Pragma: no-cache
< Vary: Accept-Encoding,User-Agent
< Content-Encoding: gzip
< Content-Length: 128
< Keep-Alive: timeout=3, max=100
< Connection: Keep-Alive
< Content-Type: text/plain
< Pragma: No-Cache
< 
* Connection #0 to host www.aweber.com left intact
{"returnCode":1,"url":"https:\\/\\/cdn5.aweber-static.com\\/hosted\\/logo\\/3360345?etag=3os9y2dTdRKrWls7FJqqEX"}

That was good, logo was updated
BUT.


Array
(
    [logo_upload] => Array $_FILES
        (
            [name] => 042.JPG
            [type] => image/jpeg
            [tmp_name] => C:\\Windows\\php5FE3.tmp
            [error] => 0
            [size] => 1344525
        )

)
Array passed to curl post
(
    [sess_token] => b2d545f99cbe1d0a7382e04670d68c719385f690
    [logo_upload] => @C:\\Windows\\php5FE3.tmp
)
Array
(
     => https://www.aweber.com/users/settings/logo
    [content_type] => 
    [http_code] => 100
    [header_size] => 25
    [request_size] => 831
    [filetime] => -1
    [ssl_verify_result] => 20
    [redirect_count] => 0
    [total_time] => 10.093
    [namelookup_time] => 0.015
    [connect_time] => 0.296
    [pretransfer_time] => 2.324
    [size_upload] => 835898
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 82819
    [download_content_length] => -1
    [upload_content_length] => 1344887
    [starttransfer_time] => 2.402
    [redirect_time] => 0
    [redirect_url] => 
    [primary_ip] => 204.194.222.28
    [certinfo] => Array
        (
        )

    [primary_port] => 443
    [local_ip] => 192.168.20.133
    [local_port] => 59665
)
Verbose information:
* Adding handle: conn: 0xc10d70
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0xc10d70) send_pipe: 1, recv_pipe: 0
* About to connect() to www.aweber.com port 443 (#0)
*   Trying 204.194.222.28...
* Connected to www.aweber.com (204.194.222.28) port 443 (#0)
* SSL connection using RC4-SHA
* Server certificate:
* 	 subject: serialNumber=DWLXYSjpKkFc6y7W/CZYHMq6UG38JteK; C=US; ST=Pennsylvania; L=Chalfont; O=AWeber Systems, Inc.; CN=*.aweber.com
* 	 start date: 2013-01-24 15:55:58 GMT
* 	 expire date: 2015-01-26 20:48:12 GMT
* 	 subjectAltName: www.aweber.com matched
* 	 issuer: C=US; O=GeoTrust, Inc.; CN=GeoTrust SSL CA
* 	 SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
> POST /users/settings/logo HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Host: www.aweber.com
Accept: */*
Cookie: AUTORESPSID=b2d545f99cbe1d0a7382e08c719385f690; AppCookie[cookie_support]=supported; AppCookie[curlis]=loren1408; AppCookie[customer]=1; TS8fba11=70e4b5e7e01c161c92dce718f51581fe3f9261532b339dbd1b0f791761e990; TS8fba11_29=a8b505b5204da88bec5a81cafd23f61000000000000000000532b2303; cookie_aweber_referrer_id=99
Cache-Control: max-age=0
Connection: keep-alive
Keep-Alive: 300
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip
Content-Length: 1344887
Expect: 100-continue
Content-Type: multipart/form-data; boundary=----------------------------e9666a86a7df

< HTTP/1.1 100 Continue
* Operation timed out after 10093 milliseconds with 0 out of -1 bytes received
* Closing connection 0

Everytime I use C:\Users\WiFi Gator\Pictures\2013-10-31/whatever.jpg it fails everytime.

Certainly I am uploading an image. but it fails, it has a name and filesize


    [logo_upload] => Array
        (
            [name] => 042.JPG
            [type] => image/jpeg
            [tmp_name] => C:\\Windows\\php5FE3.tmp
            [error] => 0
            [size] => 1344525
        )
// this is going into cURL post fields
Array
(
    [sess_token] => b2d545f99cbe1d0a670d68c719385f690
    [logo_upload] => @C:\\Windows\\php5FE3.tmp
)


BTW all tokens have been modified so there is no security risk.

I don’t get what is happening but here is what I am doing,


	$postf = array('sess_token' => $outc[1][0],'logo_upload'=>'@'.$_FILES['logo_upload']['tmp_name']);

	$url = 'https://www.aweber.com/users/settings/logo';
	$results = do_curl($url, $postf, $file, $follow);

I am ready to put on a tin foil hat.
Thank you for looking and even if it is speculation, look forward to replies.

I might add that I have an image upload script that works fine with the path, C:\Users\WiFi Gator\Pictures\2013-10-31/whatever.jpg

Ok, sounds strange.

Q 1. Is the real path from your PC
C:\Users\WiFi Gator\Pictures\2013-10-31/whatever.jpg
or
C:\Users\WiFi Gator\My Pictures\2013-10-31/whatever.jpg

Q2. For upload, do you use the file from [logo_upload][tmp_name] (the one that is on the disk)

Looks like the tmp file is created but you get “Operation timed out”
Q3. Did you check your server logs?

I see the problem, This gets crazier.
same image from same location sometimes works sometimes fails.

in every case this is what is passed into $curl,


    [logo_upload] => Array
        (
            [name] => Lighthouse.jpg
            [type] => image/jpeg
            [tmp_name] => C:\\Windows\\php69FF.tmp
            [error] => 0
            [size] => 561276
        )
CURLOPT_POSTFIELDS Array
(
    [sess_token] => 08db16a9cb878ccb439ed4b4ec6b2d71222f2f37
    [logo_upload] => @C:\\Windows\\php69FF.tmp
)

Then in curl_getinfo array, I get
[content_type] =>
or if it is successful, [content_type] => text/plain as you can see in the failed and successful attempts above, I was too tired last night to catch that.

I tried adding this
$header = “Content-type: text/plain”;

Still same problem.

I did more reading and it appears that it is up to the server, in my case, localhost to set the content type.

If the curl_getinfo call does not return it (CURLINFO_CONTENT_TYPE), the server did not send it in its HTTP headers.

I uploaded the script to a production server and it doesn’t seem to have the problem.

All this time I thought it was cURL, now I am wondering why localhost is so intermittent / picky.

Thank you all and if there is something you would like to add, please do so.