shark1234 Posted September 14, 2009 Share Posted September 14, 2009 Hello, I have made a script to allow me to upload a file to a server, and i made a second file that should allow me to display the images that are in the uploads folder. When the links are getting generated its giving me an error and I'm not sure if it is because of the server configuration or my own code. I was just wondering if anyone could give me a hand with this <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>Images</title> <script language="JavaScript"> <!-- // Hide from old browsers. // Make a pop-up window function: function create_window (image, width, height) { // Add some pixels to the width and height: width = width + 10; height = height + 10; // If the window is already open, // resize it to the new dimensions: if (window.popup && !window.popup.closed) { window.popup.resizeTo(width, height); } // Set the window properties: var specs = "location=no, scrollbars=no, menubars=no, toolbars=no, resizable=yes, left=0, top=0, width=" + width + ", height=" + height; // Set the URL: var url = "show_image.php?image=" + image; // Create the pop-up window: popup = window.open(url, "ImageWindow", specs); popup.focus(); } // End of function. //--></script> </head> <body> <p>Click on an image to view it in a separate window.</p> <table align="center" cellspacing="5" cellpadding="5" border="1"> <tr> <td align="center"><b>Image Name</b></td> <td align="center"><b>Image Size</b></td> </tr> <?php //phpinfo(); // Define the directory to view. $dir = './uploads'; // Read all the images into an array. $files = scandir($dir); // Display each image caption as a link to the JavaScript function: foreach ($files as $image) { // Ignore anything starting with a period. if (substr($image, 0, 1) != '.') { // Get the image's size in pixels: $image_size = getimagesize ("$dir/$image"); // Calculate the image's size in kilobytes: $file_size = round ( (filesize ("$dir/$image")) / 1024) . "kb"; // Make the image's name URL-safe: $image = urlencode($image); // Print the information: echo "\t<tr> \t\t<td><a href=\"javascript:create_window('$image',$image_size[0],$image_size[1])\">$image</a></td> \t\t<td>$file_size</td> \t</tr>\n"; } // End of the IF. } // End of the foreach loop. ?> </table> </body> </html> that's the code and this is the error I'm getting Forbidden You don't have permission to access /show_image.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Thanks alot EDITed for CODE tags Link to comment https://forums.phpfreaks.com/topic/174149-error-message/ Share on other sites More sharing options...
Amtran Posted September 14, 2009 Share Posted September 14, 2009 Check the attributes for show_image.php. They need at LEAST to be able to be executed by the public. (755) Link to comment https://forums.phpfreaks.com/topic/174149-error-message/#findComment-918037 Share on other sites More sharing options...
shark1234 Posted September 14, 2009 Author Share Posted September 14, 2009 well thanks alot, that was the issue the hole time. For some reason that did not even cross my mind. Thanks again Link to comment https://forums.phpfreaks.com/topic/174149-error-message/#findComment-918046 Share on other sites More sharing options...
Amtran Posted September 14, 2009 Share Posted September 14, 2009 Haha, no problem, has happened to me FAR more times than I'd like to admit. Link to comment https://forums.phpfreaks.com/topic/174149-error-message/#findComment-918047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.