Results 1 to 4 of 4

Thread: PHP+SQL+File Upload

  1. #1
    Join Date
    Jul 2005

    PHP+SQL+File Upload

    I have a job lined up requiring something new for me. The client wants to have the ability to put daily videos up on his website. All these videos will be converted to flash before putting them on the website. He tells me each video will be approimately 10-15min. I've been doing some searching, but so far haven't really found what I'm looking for.

    I do know that I can purchase a "PHP UPLOAD2" from DMXZone program that can do this, but I was thinking this should be something I can do myself.

    So here's what I'm trying to do.

    1) Create a page to upload the file. This will include an HTML based page with a name field and also the file upload, and then submit it.
    2) Then a PHP page will dump the file into a 'video' folder, and place the name and location into an SQL database.
    3) Over on the display page I have a different problem.
    3a) I will place an imageholder on the spot where the flashvideo will play
    3b) Under this video spot, will be an entire list of the videos given by name (the name field from the upload). This would be done by a pull from the SQL database
    3c) Upon clicking one of this links, it will play that video in the video holder spot.

    This upload section will be in a sql-based "user authentication" part of the website. So there is some security there, and I will make it so it only uploads flash files.

    Some direction would be most helpful. Perhaps pointing to some tutorials that you think best fit this scenario. I've been finding tutorials on 'picture uploads' similar to what I'm going for, though I know I'd have to increase the size limitations that they have placed in those. Just trying to get some further insight on this.


  2. #2
    Join Date
    May 2008
    Uploading Files: http://www.tizag.com/phpT/fileupload.php
    Flash Player for files: http://flowplayer.org/

  3. #3
    Join Date
    Jul 2005
    Thanks for that Siren.

    That flashplayer looks handy. That and it was a fun video to watch.

    As for the 'uploading files' link you sent. I have been reading through that one. It's got the basics for file uploading, but doesn't talk much to attaching it to an SQL database.

    So file uploading I will get going just to get the basics out of the way, but I will still need to figure out how to attach it to an SQL database, and then to figure out a way to display everything in the database to a page so users can pick and choose which videos they want to watch.

  4. #4
    Join Date
    May 2008
    You can't attach a file to an SQL database. You can insert the file into the database, but this is a bad way to go with video files since they're huge. You can insert a row into the database for this video using SQL. Like with MySQL:
    //file upload stuff
    $filename = the filename for the video where you move it to
    if (move_uploaded_file($_FILES["name"]["tmp_name"], $filename)){
        $sql = "INSERT INTO videos (filename) VALUES ('" . $filename . "')";
        $video_id = mysql_insert_id();
    This will insert the video info into the database, and give you the ID of the newly inserted video.

    You'll need to learn how to interact with a database using SQL. The site I gave you before has a tutorial on how to use MySQL (the most common free database) with PHP: http://www.tizag.com/mysqlTutorial/.

Thread Information

Users Browsing this Thread

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

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.09779 seconds
  • Memory Usage 2,861KB
  • Queries Executed 13 (?)
More Information
Template Usage (33):
  • (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
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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 (70):
  • 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_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_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