Results 1 to 2 of 2

Thread: Upload Image into database

  1. #1
    Join Date
    Aug 2007
    Location
    Malaysia
    Posts
    117
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Upload Image into database

    Hey,guys! I have a form to upload image into database,which had a BLOB type column called banner to store the image.How can I specific it in INSERT statement?Thanks...

    Code:
    <form name="addMovie" method="post" action="<? echo htmlentities($HTTP_SERVER_VARS['PHP_SELF']); ?>"
     enctype="multipart/form-data">
    <input type="file" name="banner" value="banner">
    </form>
    Validation for the file format is done.

    PHP Code:
    if ($_FILES['banner']['type'] != "image/gif" || $_FILES['banner']['type'] != "image/jpeg"
        { 
          
    $javascript 'alert(\'Please upload image file with gif or jpeg format   
                             only!\');'

        } 

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Insert a url/file path to the database and info if you want; store the photo in a directory, and you're done. Easier and less work for the database. Storing it in full will make the db bulky and slower.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •