www.webdeveloper.com
Results 1 to 6 of 6

Thread: i'd like to modify this blog php mysql script , so that i could upload multi media

  1. #1
    Join Date
    May 2012
    Posts
    9

    i'd like to modify this blog php mysql script , so that i could upload multi media

    i'd like to modify this blog php mysql script ( in the uploaded .zip) , so that i can upload video files , image files & embedded YouTube vids. it currently only supports text. if anyone could point me in the right direction i'd greatly appreciate it.

    Server: localhost via TCP/IP
    Server version: 5.5.16
    Protocol version: 10
    User: root@localhost
    MySQL charset: UTF-8 Unicode (utf8)
    Last edited by VictoryHawk; 05-23-2012 at 10:22 AM.

  2. #2
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    541
    You would certainly get more response if you just paste the specific PHP code here. I would like to help but downloading files other than txt files make me nervous. Just a friendly suggestion.

  3. #3
    Join Date
    May 2012
    Posts
    9
    homepage.php
    Code:
    <?php error_reporting (E_ALL ^ E_NOTICE); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!-- saved from url=(0014)about:internet -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>untitled-3.jpg</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">td img {display: block;}</style>
    <!--Fireworks CS3 Generic target.  Created Fri Jan 20 17:14:29 GMT-0500 (Eastern Standard Time) 2012-->
    <script language="JavaScript1.2" type="text/javascript">
    <!--
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    //-->
    </script>
    </head>
    <center>
    <body style="overflow:hidden;" bgcolor="#ffffff" onload="MM_preloadImages('images/untitled-3_r2_c2_s2.jpg','images/untitled-3_r2_c4_s2.jpg','images/untitled-3_r4_c2_s2.jpg','images/untitled-3_r6_c2_s2.jpg','images/untitled-3_r8_c2_s2.jpg','images/untitled-3_r10_c2_s2.jpg','images/untitled-3_r12_c2_s2.jpg','images/untitled-3_r12_c4_s2.jpg');">
    <table border="0" cellpadding="0" cellspacing="0" width="1200">
    <!-- fwtable fwsrc="Untitled" fwpage="Page 1" fwbase="untitled-3.jpg" fwstyle="Generic" fwdocid = "153907550" fwnested="0" -->
      <tr>
       <td><img src="images/spacer.gif" width="25" height="1" border="0" alt="" /></td>
       <td><img src="images/spacer.gif" width="199" height="1" border="0" alt="" /></td>
       <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
       <td><img src="images/spacer.gif" width="929" height="1" border="0" alt="" /></td>
       <td><img src="images/spacer.gif" width="46" height="1" border="0" alt="" /></td>
       <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td>
      </tr>
    
      <tr>
       <td colspan="5">&nbsp;</td>
       <td><img src="images/spacer.gif" width="1" height="31" border="0" alt="" /></td>
      </tr>
      <tr>
       <td rowspan="12"><img name="untitled3_r2_c1_s1" src="images/untitled-3_r2_c1_s1.jpg" width="25" height="669" border="0" id="untitled3_r2_c1_s1" alt="" /></td>
       <td><a href="http://gmail.com" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r2_c2_s1','','images/untitled-3_r2_c2_s2.jpg',1);"><img name="untitled3_r2_c2_s1" src="images/untitled-3_r2_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r2_c2_s1" alt="" /></a></td>
       <td rowspan="12"><img name="untitled3_r2_c3_s1" src="images/untitled-3_r2_c3_s1.jpg" width="1" height="669" border="0" id="untitled3_r2_c3_s1" alt="" /></td>
       <td><a href="homepage.php" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r2_c4_s1','','images/untitled-3_r2_c4_s2.jpg',1);"><img name="untitled3_r2_c4_s1" src="images/untitled-3_r2_c4_s1.jpg" width="929" height="100" border="0" id="untitled3_r2_c4_s1" alt="" /></a></td>
       <td rowspan="12"><img name="untitled3_r2_c5_s1" src="images/untitled-3_r2_c5_s1.jpg" width="46" height="669" border="0" id="untitled3_r2_c5_s1" alt="" /></td>
       <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><img name="untitled3_r3_c2_s1" src="images/untitled-3_r3_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r3_c2_s1" alt="" /></td>
       <td rowspan="9">&nbsp;</td>
       <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><a href="http://www.youtube.com" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r4_c2_s1','','images/untitled-3_r4_c2_s2.jpg',1);"><img name="untitled3_r4_c2_s1" src="images/untitled-3_r4_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r4_c2_s1" alt="" /></a></td>
       <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><img name="untitled3_r5_c2_s1" src="images/untitled-3_r5_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r5_c2_s1" alt="" /></td>
       <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><a href="http://jacksonville.craigslist.org/" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r6_c2_s1','','images/untitled-3_r6_c2_s2.jpg',1);"><img name="untitled3_r6_c2_s1" src="images/untitled-3_r6_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r6_c2_s1" alt="" /></a></td>
       <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><img name="untitled3_r7_c2_s1" src="images/untitled-3_r7_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r7_c2_s1" alt="" /></td>
       <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><a href="http://www.pandora.com/" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r8_c2_s1','','images/untitled-3_r8_c2_s2.jpg',1);"><img name="untitled3_r8_c2_s1" src="images/untitled-3_r8_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r8_c2_s1" alt="" /></a></td>
       <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><img name="untitled3_r9_c2_s1" src="images/untitled-3_r9_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r9_c2_s1" alt="" /></td>
       <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><a href="http://www.lynda.com/" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r10_c2_s1','','images/untitled-3_r10_c2_s2.jpg',1);"><img name="untitled3_r10_c2_s1" src="images/untitled-3_r10_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r10_c2_s1" alt="" /></a></td>
       <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><img name="untitled3_r11_c2_s1" src="images/untitled-3_r11_c2_s1.jpg" width="199" height="3" border="0" id="untitled3_r11_c2_s1" alt="" /></td>
       <td><img src="images/spacer.gif" width="1" height="3" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><a href="bookmarks.php" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r12_c2_s1','','images/untitled-3_r12_c2_s2.jpg',1);"><img name="untitled3_r12_c2_s1" src="images/untitled-3_r12_c2_s1.jpg" width="199" height="100" border="0" id="untitled3_r12_c2_s1" alt="" /></a></td>
       <td><a href="contacts.php" onmouseout="MM_swapImgRestore();" onmouseover="MM_swapImage('untitled3_r12_c4_s1','','images/untitled-3_r12_c4_s2.jpg',1);"><img name="untitled3_r12_c4_s1" src="images/untitled-3_r12_c4_s1.jpg" width="929" height="100" border="0" id="untitled3_r12_c4_s1" alt="" /></a></td>
       <td><img src="images/spacer.gif" width="1" height="100" border="0" alt="" /></td>
      </tr>
      <tr>
       <td><img name="untitled3_r13_c2_s1" src="images/untitled-3_r13_c2_s1.jpg" width="199" height="54" border="0" id="untitled3_r13_c2_s1" alt="" /></td>
       <td>&nbsp;</td>
       <td><img src="images/spacer.gif" width="1" height="54" border="0" alt="" /></td>
      </tr>
    </table>
    
    
    
    
    
    
    
    <div id="databox" style="position:absolute; top:135px;
    left:307px; overflow:auto; height:400px; width:910px; font-family:'bankGothic Md BT'; text-shadow:1px 1px 1px #000; color:#3399FF;">
    <?php include("comment.php"); ?>
    </div>
    </body>
    </center>
    </html>




    comment.php
    Code:
    <?php
    require('connect.php');
    
    $comment=$_POST['comment'];
    $submit=$_POST['submit'];
    if($submit)
    {
        if($comment)
        {
        $query=mysql_query("INSERT INTO comment (id,comment) VALUES ('','$comment')");
        header("Location: success.php");
        }
        else
        {
            echo "Please fill out all the fields.";
        }
    }
    ?>
    <html>
    <head></head>
    <body>
    <form action="comment.php" method="POST">
    <br /><br />
    <label>Enter Data:  </label><br /><textarea name="comment" cols="80" rows="1"></textarea><br/>
    <input type="submit" name="submit" value="Post" />
    
    </form>
    
    </body>
    <?php
    require('connect.php');
    $query=mysql_query("SELECT * FROM comment ORDER BY id DESC");
    while($rows=mysql_fetch_assoc($query))
    {
         $id=$rows['id'];
       
         $dcomment=$rows['comment'];
         $linkdel="<a href=\"delete.php?id=" . $rows['id'] . "\">Delete Data</a>";
         echo '<br />' . '<font color="#000099">Data:</font>  ' . '<br />' . $dcomment . '&nbsp' . '&nbsp' .
          '&nbsp' . '&nbsp' .  $linkdel  ;    
    }
    ?>
    </html>
    connect.php
    Code:
    <?php
    $connect=mysql_connect("localhost","root","") or die('mysql_error()');
    $database=mysql_select_db("comment") or die('mysql_error()');
    ?>


    delete.php
    Code:
    <?php
    require('connect.php');
    $deleteid=$_GET['id'];
    mysql_query("DELETE FROM comment WHERE id='$deleteid'");
    header("location: success.php");
    ?>
    Last edited by VictoryHawk; 05-24-2012 at 02:24 AM.

  4. #4
    Join Date
    May 2012
    Posts
    9
    success.php
    Code:
    <?php
    header("Location: homepage.php");
    ?>

  5. #5
    Join Date
    May 2012
    Posts
    9
    comment.sql
    Code:
    CREATE TABLE IF NOT EXISTS `comment` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(50) NOT NULL,
      `comment` text NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
    
    --
    -- Dumping data for table `comment`
    --
    
    INSERT INTO `comment` (`id`, `name`, `comment`) VALUES
    (1, 'hi'),
    (2, 'bye');
    Last edited by VictoryHawk; 05-24-2012 at 02:20 AM.

  6. #6
    Join Date
    Nov 2006
    Location
    Oakland
    Posts
    541
    To be able to upload files via a web form you need to send the attribute enctype="multipart/form-data" in your form tag and add an <input type="file" name="myfile"> field in your form.
    Then you need a PHP script to copy the uploaded file from the default temp folder to its final destination in your web hosting account.

    You can quickly find a php file uploader with a quick Google search or check PHP documentation on file upload; it will be more instructive.

    By the way after you save the uploaded file in a folder all you need is save the filename, folder and its title in your database. This will allow you to manage those media assets from your back-end CMS
    Last edited by holyhttp; 05-24-2012 at 02:33 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.17008 seconds
  • Memory Usage 2,923KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates