Boxerman Posted September 28, 2008 Share Posted September 28, 2008 Hi all, another question... i want all on 1 page... how can i show pictures uploaded by users? so on a page i want a upload bar etc.. and when its uploaded it gives them a link etc..but also displays it as uploaded? Quote Link to comment Share on other sites More sharing options...
dezkit Posted September 28, 2008 Share Posted September 28, 2008 mysql,php, and some knowledge of javascript Quote Link to comment Share on other sites More sharing options...
dropfaith Posted September 28, 2008 Share Posted September 28, 2008 post what you have so far and what you need that its not doing Quote Link to comment Share on other sites More sharing options...
Boxerman Posted September 28, 2008 Author Share Posted September 28, 2008 this is what i have.. <?php define ("MAX_SIZE","100"); function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } $errors=0; if(isset($_POST['Submit'])) { $image=$_FILES['image']['name']; if ($image) { $filename = stripslashes($_FILES['image']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { echo '<h1>Unknown extension!</h1>'; $errors=1; } else { $size=filesize($_FILES['image']['tmp_name']); if ($size > MAX_SIZE*1024) { echo '<h1>You have exceeded the size limit!</h1>'; $errors=1; } $image_name=time().'.'.$extension; $newname="images/".$image_name; $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { echo '<h1>Copy unsuccessfull!</h1>'; $errors=1; }}}} if(isset($_POST['Submit']) && !$errors) { echo "<h1>File Uploaded Successfully! Try again!</h1>"; } ?> <form name="newad" method="post" enctype="multipart/form-data" action=""> <table> <tr><td><input type="file" name="image"></td></tr> <tr><td><input name="Submit" type="submit" value="Upload image"></td></tr> </table> </form> how do i display the uploaded images... all of them? Quote Link to comment Share on other sites More sharing options...
Boxerman Posted September 28, 2008 Author Share Posted September 28, 2008 how do i display the uploaded images... all of them? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.