Hi Lyle, I have 5.2.4 on

cdiggity's picture
Offline
Bug Finder
Joined: 09/14/2007
Juice: 40
Hi Lyle, I have 5.2.4 on

Hi Lyle,

I have 5.2.4 on apache 2.24 win32.

Before my previous post I had tried:

       $image_URL = (string)$image->path;   // URL-encoded for http via fopen
       $image_path = urldecode($image_URL); // for direct filesystem access
...
       $local_path = file_create_path() .'/ubercart_images';
       $local_path .= '/'. basename($image_path);
       if (file_exists($local_path)
          || $size = file_put_contents($local_path, fopen($image_URL, 'rb'))){
...

and that is what generated these errors (same as my previous post)

    * warning: fopen(http://localhost/drupal-5.2/files/taranaki+copy_0.jpg) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\wamp\www\drupal-5.2\modules\ubercart\uc_importer\uc_importer.module on line 866.
    * warning: fopen(http://localhost/drupal-5.2/files/cool+shot+of+PV.JPG) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\wamp\www\drupal-5.2\modules\ubercart\uc_importer\uc_importer.module on line 866.

Note that when I paste the two URLS above in my web browser with the + instead of space I get a drupal page not found page in my web browser.

Giving fopen the urldecoded string yields these errors:

    * warning: fopen(http://localhost/drupal-5.2/files/taranaki copy_0.jpg) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\wamp\www\drupal-5.2\modules\ubercart\uc_importer\uc_importer.module on line 866.
    * warning: fopen(http://localhost/drupal-5.2/files/cool shot of PV.JPG) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in C:\wamp\www\drupal-5.2\modules\ubercart\uc_importer\uc_importer.module on line 866.

Pasting either of these two URLs into my web browser and the picture is loaded, but the URL in the taskbar has the spaces replaced with %20.

I have "clean urls" enabled. Is mod_rewrite clouding the issue? Why is the drupal URL encoding using + instead of %20 for space?

Here are the get requests from my apache log:

127.0.0.1 - - [26/Sep/2007:18:54:45 -1000] "GET /drupal-5.2/files/cool%20shot%20of%20PV.JPG HTTP/1.1" 200 164119
127.0.0.1 - - [26/Sep/2007:19:03:35 -1000] "GET /drupal-5.2/files/taranaki+copy_0.jpg HTTP/1.0" 404 3555
127.0.0.1 - - [26/Sep/2007:19:03:38 -1000] "GET /drupal-5.2/files/cool+shot+of+PV.JPG HTTP/1.0" 404 3555
127.0.0.1 - - [26/Sep/2007:19:03:33 -1000] "POST /drupal-5.2/admin/store/products/import HTTP/1.1" 302 -
127.0.0.1 - - [26/Sep/2007:19:03:40 -1000] "GET /drupal-5.2/admin/store/products/import HTTP/1.1" 200 10771

What is interesting is that in the last two lines I post to the import script to give it the XML filename and then there is the GET request to my webbrowser but the fopen() function doesn't seem to actually make an http request to the webserver.

It would probably be easier for people to create the XML import files if you use file paths instead of url encoded urls but I don't care which it is so long as it works.

-C

import image local path fix By: cdiggity (17 replies) Sun, 09/16/2007 - 02:39