Jump to content

Check extension for php output


phpbeginner

Recommended Posts

I have an upload form where a user can upload either 1  .jpg or 1 document for each section of a webpage and the database is storing a link while the file is uploaded to a folder.

 

The form will only allow to upload one or the other, not both. On my output I want to distinguish wether the file is .jpg for some coding for an image. If it is not a .jpg extension then it will go into another area. Is there an easy way to do this ? Below is my code that I tried for the output.....

 

<?php
if($row[6]!=".jpg")
							{
                              echo("<p>
<img src='??????/" . $row[6] . "' align='left' hspace=10 vspace=5 width=100></p><p>" . $row[5] . "</p><br><br><br>");                                

                              
                         }
else
{
echo("<p>" . $row[5] . "</p>");
echo("<p><a href='??????" . $row[6] . "'>READ MORE</a></p>");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.