I don,t know how can upload videos in database and retrive
to the database
Videos cant save in videos folder.
------
update
so what can i do which place i change - <?php
-
-
if ($_POST["action"] == "Load")
-
{
-
$folder = "videos/";
-
-
-
-
move_uploaded_file($_FILES["filep"]["tmp_name"] , "$folder".$_FILES["filep"]["name"]);
-
-
echo "<p align=center>File ".$_FILES["filep"]["name"]."loaded...";
-
-
$result = mysql_connect("localhost", "root", "") or die ("Could not save name Error: " . mysql_error());
-
mysql_select_db("v1") or die("Could not select database");
-
mysql_query("INSERT into video (URL) VALUES('".$_FILES['filep']['name']."')");
-
-
if($result) { echo "Video name saved into database";
-
echo "<a href='retrivevideos.php'><input type='button' value='Retrive'></a>";
-
}
-
else {
-
-
//Gives and error if its not
-
echo "Sorry, there was a problem uploading your file.";
-
}
-
}
-
?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.facebook.com/exequiel.s.vibar">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
<title>Sampol upload ni zick</title>
-
</head>
-
<?php
-
include'connect_to_db.php';//connection to database
-
?>
-
<body>
-
<br><br>
-
<center>
-
<?php
-
//code for uploading videos...
-
if(isset($_POST['video'])){//button for Upload
-
$target = "uploaded_folder/"; //folder where to save the uploaded file/video
-
$target = $target . basename( $_FILES['uploaded']['name']) ; //gets the name of the upload file
-
$ok=1;
-
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
-
{
-
$query =mysql_query( "INSERT INTO tbl_video(video_name) VALUES ('$target')");//insertion to database
-
-
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
-
}
-
else {
-
echo "Sorry, there was a problem uploading your file.";
-
}
-
}
-
?>
-
-
<form enctype="multipart/form-data" method="POST">
-
Please choose a file: <input name="uploaded" type="file" /><br />
-
<input type="submit" value="Upload" name="video"/>
-
</form>
-
-
<br><br>
-
<br>
-
</center>
-
</body>
-
</html>
you can upload any files in this code, because we did not restrict the file extension...
12 20610
you dont need to upload the upload the video you just need to get the address and save it in database.
if you already tried to upload an image, the way on how to upload an image is just the same on how to upload a video. Only the file extension is the difference.
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.facebook.com/exequiel.s.vibar">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
<title>Sampol upload ni zick</title>
-
</head>
-
<?php
-
include'connect_to_db.php';//connection to database
-
?>
-
<body>
-
<br><br>
-
<center>
-
<?php
-
//code for uploading videos...
-
if(isset($_POST['video'])){//button for Upload
-
$target = "uploaded_folder/"; //folder where to save the uploaded file/video
-
$target = $target . basename( $_FILES['uploaded']['name']) ; //gets the name of the upload file
-
$ok=1;
-
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
-
{
-
$query =mysql_query( "INSERT INTO tbl_video(video_name) VALUES ('$target')");//insertion to database
-
-
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
-
}
-
else {
-
echo "Sorry, there was a problem uploading your file.";
-
}
-
}
-
?>
-
-
<form enctype="multipart/form-data" method="POST">
-
Please choose a file: <input name="uploaded" type="file" /><br />
-
<input type="submit" value="Upload" name="video"/>
-
</form>
-
-
<br><br>
-
<br>
-
</center>
-
</body>
-
</html>
you can upload any files in this code, because we did not restrict the file extension...
ok thanks Exequiel for given code.
how i retrieve video in database if any idea or code please give me
hay Exequiel in this code do not upload videos?why
and not save path in database but any other file uploaded
hemaldazzle it works. include'connect_to_db.php'; maybe, error in this line.
yes that is work but not upload video in upload folder and database
you check file upload limit. it should work.
- <?php
-
$con=mysql_connect("localhost","root","") or die ("COULD NOT CONNECT TO YOUR DATABASE!");
-
mysql_select_db("upload_sample",$con);
-
?>
try this code for the connection to your database, save it as connect_to_db.php,
you can retrieve the video in db by its file name and Id. and you must set the destination of your uploaded file, example,
../uploaded_folder/$var_for_filename; //the destination where the uploaded file(s) being saved and its file name. try it in sql .
I was actually just about to say that. I don't suggest uploading a video into a database as in a multimedia database because you would need to use a blob, which is difficult to deal with. You'll want to use that form script that was provided, make sure that you allow users to upload the correct size for the files, make sure that the directory is read/write=777, and you copy the URL into the database as a text. What I even suggest is maybe generating a random name before completing the script (this would most likely require a rename at the end of the script), but this part is not mandatory. All you really need is the file name and know where the videos would be stored.
Hope that helps!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: R Reyes |
last post by:
what are the pros/cons of uploading a file into a database (like access, sql
server, oracle) vs. uploading a file into a folder (and only storing its path
in a database table) ?
i've never had...
|
by: Mattias |
last post by:
Hi
I am building a simple database system in MS Access 2002 and would
like to create a command button that upon clicking transfers the
current mdb-file to an ftp-server. Is there a solution for...
|
by: AHMLIVE |
last post by:
Hi everyone.
I got a problem when i tried to upload MYSQL database. I don't have any idea how to upload it. It is my first time to do it. I already upload the pages from my local pc to server...
|
by: ammoos |
last post by:
hiiii friends...i want to upload some selected mysql datarecords from my offline system which is written in vb to online system which is made by asp.net with vb. i also want to make some processing...
|
by: nirbhay |
last post by:
I am using Asp.net 1.1 with Back end as C# i want to Use CSV file Validate it and upload to Database sql server 2K with all error check...Validation of Fields etc
|
by: xxoulmate |
last post by:
how to upload a database on the mysql server., i am using mysql version 4.0.1
that database is not yet existing in the server.
and that database in a format of file.sql(came from a mysqldump)
|
by: creative1 |
last post by:
Hello everyone,
I am working on a site that provide a facility to downlaod videos , available on the server (only to a specific group of members).
There should be afacilty to uplaod videos through...
|
by: dragiton |
last post by:
SA Upload SQL Database variable types (image upload and storage)
I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to...
|
by: ahmurad |
last post by:
Dear Brothers,
I want to upload XLS/CSV huge data (90,000 rows in a XLS/CSV file) into MYSQL database.
I want to use only Import option of phpmyadmin to upload XLS/CSV files. How can i to...
|
by: neelsbr |
last post by:
how to upload mysql database to my server space (hostgator,bluehost) in programming method.any one can help me to do this.
Thanks in Advance
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |