Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Image Upload: Displaying unwanted information
Old 04-24-2010, 06:35 PM Image Upload: Displaying unwanted information
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Hey guys.

I am working on putting together a back-end for a website I am working on and am making an image uploading script. Below is the script that is supposed to display all of pictures in a set folder.

PHP Code:
<?

//define the path as relative
$path "../images/news/";

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

echo 
"Directory Listing<br/>";

//echo "<iframe scrolling='yes'>";
while ($file readdir($dir_handle)) 
{
   if(
filetype($path.$file)=="file")
    echo 
"<div style='width:320px; border:1px solid green; clear:both;'>";
    echo 
"<div style='width:100px; float:right;'><a href='JavaScript:void(0);' onclick='copy(\"http://www.lauriernetimpact.com/images/news/".$file."\");'>Copy Link to Clipboard</a><br /><br /><a href=''>Delete</a></div>";
    echo 
"<img height='100px' src='../images/news/".$file."' alt='Image' />";
    echo 
filetype($path.$file);
    echo 
"</div>";
}
//closing the directory
closedir($dir_handle);

?>
The issue is that its also echoing out the information for the directories. I thought by including the if statement I would avoid that but it doesnt seem to be working at all. The strange thing is that the directories don't have the test border around them like the normal images, and they don't group with the images either.

Its in a protected directory so if my explanation sucked I can move it to an open directory so you all can actually look at it.

Thanks
__________________
DVD Movie Release Database:
Please login or register to view this content. Registration is FREE
Truly is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-27-2010, 07:31 AM Re: Image Upload: Displaying unwanted information
Super Talker

Posts: 139
Name: John Davis
Trades: 0
Guest it should be as following:
PHP Code:
<?
....
if(
filetype($path.$file)=="file") {
    echo 
"<div style='width:320px; border:1px solid green; clear:both;'>";
    echo 
"<div style='width:100px; float:right;'><a href='JavaScript:void(0);' onclick='copy(\"http://www.lauriernetimpact.com/images/news/".$file."\");'>Copy Link to Clipboard</a><br /><br /><a href=''>Delete</a></div>";
    echo 
"<img height='100px' src='../images/news/".$file."' alt='Image' />";
    echo 
filetype($path.$file);
    echo 
"</div>"
}
.....
?>
__________________
»
Please login or register to view this content. Registration is FREE
- Interactive maps for websites
»
Please login or register to view this content. Registration is FREE
for web developers
MapMaster is offline
Reply With Quote
View Public Profile Visit MapMaster's homepage!
 
Old 04-27-2010, 03:11 PM Re: Image Upload: Displaying unwanted information
Truly's Avatar
Ultra Talker

Posts: 322
Trades: 0
Thanks for the reply MapMaster

It turns out I just made a few basic errors (forgot a closing quotation and didn't setup my divs right). Lesson as to why you shouldn't code when really tired .

I appreciate the response!
__________________
DVD Movie Release Database:
Please login or register to view this content. Registration is FREE
Truly is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Image Upload: Displaying unwanted information
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16405 seconds with 12 queries