0) { echo 'Video with this video type already exists. Please delete the video and upload again'; return; } mysqli_stmt_close($fv_stmt0); } if (is_uploaded_file($fv_file['tmp_name'])) { if (move_uploaded_file($fv_file['tmp_name'], $fv_targetPath)) { $fv_fileName = $fv_file['name']; $fv_fileSize = m_bytesToSize1024($fv_file['size'], 1); if ($fv_stmt = mysqli_prepare($pv_link, "INSERT INTO vullo_lecture_videos (`lecture_id`,`video_file_name`,`video_type`) VALUES(?,?,?)")) { mysqli_stmt_bind_param($fv_stmt, "iss", $pv_lectureId, $fv_fileName, $fv_fileType); mysqli_stmt_execute($fv_stmt); $inserted = mysqli_insert_id($pv_link); mysqli_stmt_close($fv_stmt); echo '{"id":'.$inserted.',"lectureId":'.$pv_lectureId.',"name":"'.$fv_fileName.'","type":"'.$fv_fileType.'"}'; } } else { echo "Error uploading a file"; echo $fv_file['error']; switch ($fv_file['error']) { case 1: print '
The file is bigger than this PHP installation allows
'; break; case 2: print 'The file is bigger than this form allows
'; break; case 3: print 'Only part of the file was uploaded
'; break; case 4: print 'No file was uploaded
'; break; } } }else { echo "Upload error"; } } ?>