Jump to content
Larry Ullman's Book Forums

Recommended Posts

I was having problems with script 10.5. I thought it may be due to the folder permission for the 'uploads' folder, so I tried it on a folder called Images in the htdocs folder. This I managed to get working.

Applying this back the script trying to access the 'uploads' folder still didn't overcome the problem. Script 10.4 works as it lists the images in the 'uploads' folder. However, when I click on a link in the table generated by script 10.4, I get a pop up window with error 404 - File or directory not found.

I tried to view the images in the uploads folder without script 10.5, by:

'URL'/..uploads/image_name.jpg

But had the same result, although 'URL'/Images/image_name.jpg worked fine

(In both cases the image_name was valid).

Why can I create a list of images, yet not be able to view them from that list?

 

Thanks in advance.

Share this post


Link to post
Share on other sites

It sounds like your paths and/or URLs are incorrect. What's the directory structure of all this and what are the URLs involved?

Share this post


Link to post
Share on other sites

That may be the case, but I can't see the error yet. I must have the correct path and URL for script 104 (images) to work.  I can apply script 105 to look at a sub folder of 'htdocs' i.e. 'url/images' but not to one that is adjacent to htdocs, in this case 'uploads'.

 

see

http://www.chris-muten.com/Images104.php for a list of images in 'uploads', for which script 105 doesn't quite work.

 

and

http://www.chris-muten.com/Images104c.php for a list of images in www.chris-muten.com/Images for which script 105 works well.

 

A screen shot of the uploads directory can be seen at

 

http://www.chris-muten.com/Images/show_image105c.php?image=uploads.jpg

 

(I tried to add this image here as png then jpg but in both cases the following error message appeared:

"You are not allowed to use that image extension on this community.").

Share this post


Link to post
Share on other sites

Your URLs have "../uploads" in them (in the JavaScript), which is a problem. Also, the show_image.php script has to be within htdocs but pull images from another directory. You should review the section of the book, which goes over this in detail. 

Share this post


Link to post
Share on other sites

Larry,

 

I think I tried putting the show_images script in different places to see if it would work, it is now back in htdocs, and is now working - although it didn't initially.

 

When it didn't work I re-read the chapter and checked the scripts, but didn't think I had found any errors, reloaded the scripts and all seems to be working well.

 

Only wish I knew what sript errors I had corrected.

 

Share this post


Link to post
Share on other sites

I'm glad it's working for you now. Personally, though, I'd strongly advise against trying different things just to see if it'll work. You really ought to be trying things when you have the expectation that it will work. And if you don't know what should work, that's when you would ask. 

 

The reason I highlight this point is that trying different things in the hopes they'll work does nothing to further your knowledge and is likely to confuse you even further.

 

Just a thought for you...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×