File isn't being found in directory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
snowrhythm
Forum Commoner
Posts: 75
Joined: Thu May 04, 2006 1:14 pm
Location: North Bay Area, CA

File isn't being found in directory

Post by snowrhythm »

hello...i've got a simple JS script that opens a picture in a new window. it's passed the directory path to the picture and every time
the path comes up correctly but it can't find the file...and the file is DEFINITELY there. anyone have any clue why it comes up "Not Found"?

Code: Select all


  function OpenPic(urlForPic){
      window.open(urlForPic, '', 'width=auto, height=auto, scrollbars=0, toolbar=0');
  }

Code: Select all

function QueryExec($sql){

      if(!empty($sql)){

        $query = mysql_query($sql);

        while($qryResults = mysql_fetch_array($query)){

          $theLink[] = $qryResults['photo_name'];

        }

        echo '<h5 class="picTitle">'.$_GET['cat'].'&nbsp;&nbsp;Photos</h5>';

        echo '<div class="thumbWrap">';

        foreach($theLink as $link){

          echo '<div class="picCell" id="http://localhost/Freelance%20Work/Ashland/2007/images/'.$link.'" onclick="OpenPic(this.id)">pic</div>';

        }          

      } else {

        return false;

      }

    }
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

What are the file/directory permissions?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

8O that is a terrible use of the ID attribute...why not just hard-code the URL into the onclick function itself?
User avatar
snowrhythm
Forum Commoner
Posts: 75
Joined: Thu May 04, 2006 1:14 pm
Location: North Bay Area, CA

Post by snowrhythm »

the file permissions are totally fine...i'm using the ID attribute because I
want more control over the window that i'm opening. eventually i'll be
using LightBox, but until then this was the only way (i thought) i could
spec the window how i wanted it. Am i wrong? can i have control over
the new window without using js?
Xoligy
Forum Commoner
Posts: 53
Joined: Sun Mar 04, 2007 5:35 am

Post by Xoligy »

Change:
id="http://localhost/Freelance%20Work/Ashla ... es/'.$link.'" onclick="OpenPic(this.id)"

To:

onclick="OpenPic(\'http://localhost/Freelance%20Work/Ashla ... es/'.$link.'\');"

Makes much more sense. It will probably fix your problem too.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Just install and use lightbox right now... Include the javascript/css files, add a class to your images and wham! You're done!
User avatar
snowrhythm
Forum Commoner
Posts: 75
Joined: Thu May 04, 2006 1:14 pm
Location: North Bay Area, CA

Post by snowrhythm »

hey thanks alot guys....I can't really try that stuff yet because i'm at work and that code is for a freelance
project at home. but i'll check it out first thing tonight and let you know how it turns out. right before i
go see 300!
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

snowrhythm wrote:right before i
go see 300!
If you expect any further help of this matter, you will be required to submit an review of the movie ;)
User avatar
snowrhythm
Forum Commoner
Posts: 75
Joined: Thu May 04, 2006 1:14 pm
Location: North Bay Area, CA

Post by snowrhythm »

lol....right on, except i'm all depressed now because I forgot that it comes out on the 9th and not tonight :(
User avatar
snowrhythm
Forum Commoner
Posts: 75
Joined: Thu May 04, 2006 1:14 pm
Location: North Bay Area, CA

Post by snowrhythm »

alright, i got lightbox installed and everything is working great. thanks for the help guys.
Post Reply