• We just launched and are currently in beta. Join us as we build and grow the community.

How To Create Video Uploader

monaco

Voice Search Pro
M Rep
0
0
0
Rep
0
M Vouches
0
0
0
Vouches
0
Posts
42
Likes
45
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
In this tutorial, we are going to learn how to create Video Uploader using PHP/MySQL. This simple project for video uploader. This project allows the user to upload their desired video and save into the database. The user can upload their video below 15MB or 15 MegaBytes which you can edit the file size limit after downloading the source code.

Creating INSERT Statement

This PHP source code used to insert the desired video uploading by the user.
  1. <?php

  2. // print_r ($_FILES['file']);

  3. if

    (

    isset

    (

    $_FILES

    [

    'file'

    ]

    )

    )
  4. {
  5. $name

    =

    $_FILES

    [

    'file'

    ]

    [

    'name'

    ]

    ;
  6. $extension

    =

    explode

    (

    '.'

    ,

    $name

    )

    ;
  7. $extension

    =

    end

    (

    $extension

    )

    ;
  8. $type

    =

    $_FILES

    [

    'file'

    ]

    [

    'type'

    ]

    ;
  9. $size

    =

    $_FILES

    [

    'file'

    ]

    [

    'size'

    ]

    /

    1024

    /

    1024

    ;
  10. $random_name

    =

    rand

    (

    )

    ;
  11. $tmp

    =

    $_FILES

    [

    'file'

    ]

    [

    'tmp_name'

    ]

    ;
  12. if

    (

    $size

    >=

    15971520

    )
  13. {
  14. $message

    =

    "File must not greater than 15mb"

    ;
  15. }
  16. else
  17. {
  18. move_uploaded_file

    (

    $tmp

    ,

    "videos/"

    .

    $random_name

    .

    '.'

    .

    $extension

    )

    ;
  19. mysqli_query

    (

    $con

    ,

    "INSERT INTO tbl_video (name,url)
  20. "

    #@%+=FEFGT6R3987EFDF86347GR=+%@#" VALUES('$name', '$random_name.$extension')");
  21. $message

    =

    "Video has been successfully uploaded !"

    ;
  22. }

  23. echo

    "$message

    <br/> <br/>"

    ;
  24. echo

    "size: $size

    mb<br/>"

    ;
  25. echo

    "random_name: $random_name

    <br/>"

    ;
  26. echo

    "name: $name

    <br/>"

    ;
  27. echo

    "type: $type

    <br/><br/>"

    ;
  28. }

  29. ?>

Creating File Updload - HTML

This HTML source code is used to create input type file.
  1. <form

    method

    =

    "post"

    enctype

    =

    "multipart/form-data"

    >
  2. Select Video : <br

    /

    >
  3. <input

    name

    =

    "UPLOAD_MAX_FILESIZE"

    value

    =

    "20971520"

    type

    =

    "hidden"

    /

    >
  4. <input

    type

    =

    "file"

    name

    =

    "file"

    id

    =

    "file"

    /

    >
  5. <br

    /

    ><br

    /

    >
  6. <input

    type

    =

    "submit"

    value

    =

    "Upload"

    /

    >
  7. </

    form

    >

This is the result:

1_119.png


So what can you say about this work? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Thank you very much.


Download
You must upgrade your account or reply in the thread to view the hidden content.
 

452,292

324,186

324,194

Top