I have read several forums that advise against storing videos in a database. I unfortunately am forced to do so based on constraints for a school project I am working on. I was wondering if someone would let me know where I am going wrong when trying to store my video into the database. We are using an embedded procedure(someone else in my group wrote them that may be the problem)but after retrieving the video from the form it is returned as an Array which contains the name, type, error, location, etc(things associated with the video). After retrieving the array from the form I naively tried to insert the whole thing into the data based via function call through a query as seen below. This gives an immediate error “Unknown column ‘Array’ in ‘field list’ “. I get that Array is the type of $video after we pull it from the form but I’m not sure where to go from there.
if(empty($_FILES['sonogram'])) {
echo 'The file exceeded maximum';
}
else {
$video = $_FILES['sonogram'];
}
//call our embedded procedure to add the video to the database
mysql_query("call SaveImage($studyId, $video, 'nothing new')");
Could anyone just let me know if I am making a simple error(syntax, etc..) or if there is something missing due to working with the blob/mp4.
Thanks
$_FILES is basically just an information array. It doesn’t contain your actual file. You will need to open the file, read the content and then save it to the database.
Never tested the following, especially with videos: