I have two sites installed. The main site is installed in the root of my hosting account. The second site is installed in a directory within the main site. I did this as I wanted a different look for the second site, but wanted to use the same database that the first one uses. Everything works great EXCEPT for the photos and thumbnail images. Does anyone know how to hardcode the path to the main photos and thumbs directory into the second install so that it puts those images into the main sites photos and thumbs directories? I think it would be in the .... includes\classes\images\class_upload.php file. That file writes a temp file first and then moves the file to the destination. ..... // Move the file to the given location function moveFile($source, $destination) { $this->debug("<b>Moving the file to the destination</b><br/>"); // Check if you have write permissions $this->debug("Checking permissions<br/>"); if (is_writeable($this->path)) { if (move_uploaded_file($source, $destination)) { // Change file permissions @chmod($destination, 0644); // Add filename to array with done files $this->done[] = $destination; $this->debug("file moved to <font color=\"#000099\"><b>".$destination."</b></font><br/>"); } else { // Give an error if no write permissions $this->error('writePerm', $destination); } } else { // Give an error if no write permissions $this->error('writePerm', $destination); } } ----------------------------------------------------------- Would anyone know how to hardcode the $destination into the code above, or know where to change the "$path" to the photos and thumbs directory for the second install so it uses those directories to save it's files in? Your help would be greatly appreciated. Thanks you.
Have you scanned the code to see what the variable $destination is defined? I would think you could just hard code that in the second site.
The only place I can find the var $destination is in that one file. I have not tried replacing that variable with the actual address to the original photos and thumbs directories. Not quite sure how you'd that that.
Still need help with this .... I know how to use the {debug} command in the layout.tpl to show the info as you're going through the site, HOWEVER, when the program is uploading and saving the images, this debug command has no effect. Does anyone know how to debug just a file such as the one I mentioned in my first post .... includes\classes\images\class_upload.php that way I may be able to tell what the $destination variable is actually assigned to. Any help would be greatly appreciated. Thanks.
At the top of the class_upload.php file where all the other variables are defined you can probably override the value and just set a new one.... $destination = "/path/to/my/thumbs/"; it may take some experimentation to get the path right.
Thanks Larry, I'll try that. But just an update to what I've just tried that also didn't work. I went right to the guys site who wrote the PHP Upload module that 68C is using. They told me thru an online chat to simply indicate the path to the photos and thumbs directory right there in the file I am uploading from, which, in my case, is the step5.php file located in the .... includes/core/checkout directory. they said the variables would be .... $ppu->path = "photos"; $sip->pathThumb = "thumbs"; so I set them using the actual directory scheme for my site, right from the root, which is /home at my hostgator shared hosting, and it still did not work, so I did the debug thing and found out that the variables, $ppu and $sip were not being picked up or indicated in the debug screen, so those variables aren't being used. I'll try your idea and let you know. Thanks again as always for your help Larry. I really appreciate it. .
Hey Guys; Thanks for all your suggestions. But nothing seems to work. It just won't accept any other path than the ones intended. And just to show that I am trying, I even went back to the folks who actually wrote the module "Pure PHP File UPload", which is the file 68C calls .... class_upload.php ...., and this time I chatted with the person who actually wrote the code, George Petrov, and was told by him that I should go to the folks I bought my program from for help, as they only help their Dreamweaver Extensions, and ended the chat. And David, Hostgators directory structure, at least in my case, was said to be .... /home/mrgforce/public_html ....... even though all you see is the public_html when you ftp into your site. Thanks again guys for all your help. If I finally figure it out, I'll post what I did. .
Instead of saying nothing works, it would be helpful if we knew what you tried. The idea of editing $ppu->path = "photos"; in step5.php is probably your best bet, but how to alter that path depends on your web hosting and what your home path actually is and what scripts that run on your server think their path actually is. This isnt rocket science but at the same time may take a little trial and error and we cant tell you what to try if your not telling us what you have tried. If we look at the variable assignment in step5.php we see this.. $ppu->path = "photos"; By that we can assume the path is relative to the documents root. However document root for one site will be different than document root for a site in a different subdirectory. If you ftp to your site and look inside your /home/mrgforce/public_html folder where are your 2 sites located? Please post where your index.php files are for your 2 sites....for example..... site A: /home/mrgforce/public_html/index.php site B: /home/mrgforce/public_html/siteB/index.php
Larry, you are absolutely right. I think you need to do the same in useraddimages.php and edit the templates (tpls) to point to the new image paths
Here goes. First I will tell you that I run the purple template, and I have the multi-image module enabled, which also changed the step5 file. Several weeks ago, I installed a second copy of 68C into a directory in the root of my main site. I simply wanted a different look, but wanted to use the same database for all the info. My directory structure is exactly as Larry stated.... Main site is installed in the root: /home/mrgforce/public_html/index.php site B is in a directory in the root: /home/mrgforce/public_html/siteB/index.php EVERYTHING, AND I MEAN EVERYTHING works exactly as it should EXCEPT FOR the photos and thumbnails alternative location. If someone puts in a new listing that includes photos, they will show up in siteB, but will show a box with the red X when visiting the main site because it is looking for the thumbs and photos in it's respective directories. Each install will place them in their respective folders. It has been several weeks of trying off and on, but I'll try and remember what I did and to which files. The file I've tried changing paths in is the following .... step5.php I also originally hardcoded the paths to the photos and thumbs in siteB to display them from the main site when accessing the showlistings and viewlisting templates. Didn't notice the problem until someone found siteb, registered, and put in a new listing with a photo. That's when I saw the error. The photo and thumb were not placed in the main sites directories so they did not show up when visiting siteB because of the hardcoding. If they didn't put in a photo, it was fine because I had the no-photo jpg in both sites. So I removed the hardcoding in the layout, showlistings and viewlisting templates. Now when someone put in a photo when visiting siteB, everything was fine EXCEPT, when visiting the main site, the photos and thumbs were missing again. Been copying back and forth to keep things looking right which is a pain. 1. I contacted the company whose name is in the copyright of 68C's ... class_upload.php ... file which is located in the .... includes\classes\images directory. The first guy I talked to said that the only thing controlling the location of both the photos and thumbs are the $ppu->path and the $sip->pathThumb statements in the ... step5 .... file. I have tried every combination of the stucture shown above from the full absolute path, to partial starting with the public_html to using ../../ schemes to actually putting in the URL to the main sites photo and thumbs directories, and step5 of the checkout program simply ignors anything you put in those path statements. The file that I believe actually controls the paths is the .... class_upload.php .... file, but the people who wrote the file won't help now when I call back. They say it's 68C's job to help not theirs. And I'm not familiar enough with php to tackle that one, so that is where I'm at. Sorry I can't tell you more. .
In the step5.php and useraddimages.php find: $ppu->path = "photos"; change $ppu->path = "/home/mrgforce/public_html/photos"; and find: $sip->pathThumb = "thumbs"; change: $sip->pathThumb = "/home/mrgforce/public_html/thumbs"; If you arent sure about the path create a page (ANYTHING.php) with the following code in it, and view from your browser, and it will show you all you need to know about the PHP environment. <? phpinfo(); ?>
Dont need any more, all we really ever needed was the full path to where your sites are located. Then, if you did try path changes, where and what paths you tried would prevent us from making suggestions you may have tried. Try pipelins absolute path suggestions and if they dont work we will give you a relative path to try.
Sorry. I did try ..... /home/mrgforce/public_html/photos /mrgforce/public_html/photos /public_html/photos ../photos ../../photos and the main sites complete url followed by the /photos did the same for the thumbs also. The script doesn't seem to see these path statements, or they are being changed immediately by something in the .... class_upload.php file. Don't know how much different php is from html, but for the last 12 years I've done this type of thing many many times with html and cgi scripts, and I've always been able to see things like path, hidden instructions, etc when I go to the page that displays the form and look at the source code. But when I look at the source code for step5, all I see is a <scr reference simply to /thumbs. Shouldn't we be seeing these paths in the source code for step5? Just curious. .
there is also a fullpath variable which uses the $_SERVER['PHP_SELF'] and appends the $path to it so that may be mucking things up. I would find this line in the class_upload.php file... $this->fullPath = '/'.substr($_SERVER['PHP_SELF'], 1, strrpos($_SERVER['PHP_SELF'], '/')).$this->path.'/'; and change it to something like tjis.... $this->fullPath = '/siteB/' . $this->path.'/'; and see if that help. To troubleshoot whats going on open /checkout/step5.php and find the list of variables $ppu-> and under the list of them ad this in... print_r($ppu); then place an ad and upload a file, when its done uploading you should get a bunch of data on the screen showing the contents of the ppu array and you should be able to see if the fullpath element of the array is correct.
Yes David I am. I mentioned that a couple of posts back. Does that change what Larry indicated to do? I'll wait to hear before applying his suggestion, which sounds very promissing.