Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Assignment 7 Part II -- Art Gallery Results</title>
- </head>
- <body>
- <?php
- $uploadDir = 'images/';
- $uploadFileDir = $uploadDir . basename($_FILES['uploadFile']['name']);
- if(isset($_FILES['uploadFile'])) {
- if($_FILES['uploadFile']['error'] != UPLOAD_ERR_OK ||
- $_FILES['uploadFile']['mime'] != "image/gif") {
- print "<p>File not uploaded successfully!</p>";
- print "<p>Please make sure the file has the correct file extension: .gif</p>";
- print "<p><a href='a7p2.php'>Try uploading again</a>";
- var_dump($_FILES['uploadFile']['error']);
- die;
- } else {
- move_uploaded_file($_FILES['uploadFile']['name'], $uploadFileDir) or die("Can't move file to $uploadFileDir");
- print "<p>Success!</p>";
- }
- }
- */
- $uploadedFiles = glob("/students/ryan/php/images/*.gif");
- if($uploadedFiles != false) {
- print "<p>Here are pictures from the art gallery: </p>";
- foreach($uploadedFiles as $file) {
- $url = "http://hills.ccsf.edu/~ryan/images/" . substr($file, strrpos($file, '/') + 1);
- print "<p><img src=\"$url\"></p>";
- }
- } else {
- print "There are no pictures in the art gallery";
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement