Error (ERROR_BAD_PATH)
jlhughes
Joined: 2002-06-05
Posts: 81 |
Posted: Mon, 2003-05-05 07:22 |
I've installed G2 on an XP Home box. I also have G1 running on this box. The G2 code was downloaded from the CVS on Saturday morning. I was getting the Error (ERROR_BAD_PATH) error when I attempt to add photos to the gallery. (The test harness has no problem adding albums and photos.) The debug info for the error can be viewed at http://63.195.151.43/g2/error.txt At the end of the debug info are these two lines: file_exists(c:\apache\htdocs\g2\gallery2\modules\core/classes/GalleryPhotoItem.class) file_exists(c:/apache/tmpphp48.tmp) The second line is missing the slash between the temp directory name (c:/apache/tmp) and the file (php48.tmp) My original PHP.INI had the upload_tmp_dir set to c:/apache/tmp When I changed it to c:/apache/tmp/ I was able to upload. I use the same directory for PHP session directory WITHOUT the trailing slash. QUESTION: Is G2's problem with the lack of a trailing slash on directory names a BUG or my error? NOTE: When I first installed G1 on this same box it wouldn't allow me to upload using a file directory because I didn't have the upload_tmp_dir specified. When I added the directory WITHOUT the trailing slash, G1 had no problem adding files. When I added the trailing slash G1 still worked fine. THEREFORE, it seems G2 is more sensitive on this topic than G1 was. |
|
Posts: 7994
G2 is definitely more sensitive about trailing slashes. All of the directory paths in G2 are expected to have a trailing slash at the end. There's a complicated reason for this that I can go into in detail if you're curious.
However, I don't quite see how this would cause the problem you're seeing so let's investigate. When you upload a file using PHP, it stores the file in the tmp dir then passes an array with info about the stored file to Gallery. So let's see what Gallery is receiving. Edit ItemAddChildren.inc and right after line 80:
$file = $form['fileUpload'][$i];
add this line:
$gallery->debug_r($file);
Post the output from that, it'll give us an idea of what we're starting with.
Posts: 81
I modified ItemAddChildren.inc.
Debug info with no trailing slash in PHP.INI upload_tmp_dir can be viewed at [url]63.195.151.43/g2/noslash.txt[/url].
Debug info with the trailing slash upload_tmp_dir can be viewed at [url]63.195.151.43/g2/withslash.txt[/url].
Posts: 7994
Ok, and one more thing. Can you add this line:
Right under the other line and post the results of that? That'll help me to determine what the original values were before the form processing code got a hold of it. I'm probably just doing something weird with the input before it gets to the controller.
Posts: 81
Added the line and tried again.
For the debug with no trailing slash PHP.INI upload_tmp_dir see the file http://63.195.151.43/g2/globals_noslash.txt
For the debug with a trailing slash PHP.INI upload_tmp_dir see the file http://63.195.151.43/g2/globals_slash.txt
Posts: 11
note that "systemdefault" doesn't work either - i.e. if oyu do not set an upload dir
it has to be forward slashes
d:/temp/ will work
d:\temp\ will not
Posts: 7994
ARGH! My bad I told you the wrong thing to enter. I meant to say, add this line:
Sorry to make you jump through all these hoops! Thanks.
Posts: 81
Added HTTP_POST_FILES
For the debug with no trailing slash PHP.INI upload_tmp_dir see the file http://63.195.151.43/g2/files_noslash.txt
For the debug with a trailing slash PHP.INI upload_tmp_dir see the file http://63.195.151.43/g2/files_slash.txt
Posts: 7994
Aah, ok I see what's going on now. I'll fix this ASAP.
Posts: 7994
Ok, I think I fixed this one. Try it out and let me know. If it fails, give me the same debug as you did last time.