File: upload.php

Recommend this page to a friend!
  Classes of Subin Siby  >  Francium JavaScript Voice Recorder  >  upload.php  >  Download  
File: upload.php
Role: Auxiliary data
Content type: text/plain
Description: Upload Audio Example
Class: Francium JavaScript Voice Recorder
Record user voice and encode it as MP3 or WAV
Author: By
Last change: Version 0.4
Date: 7 months ago
Size: 653 bytes


Class file image Download
 * Request has Base64 Data
 * -----------------------
 * $_POST['audio'] is the Base64 encoded value of audio (WAV/MP3)
  $audio = base64_decode($_POST['audio']);
  echo $audio;

 * Request has BLOB Data
 * ---------------------
  $audio = file_get_contents($_FILES['file']['tmp_name']);
  require_once __DIR__ . "/db.php";
  $sql = $dbh->prepare("INSERT INTO `uploads` (`audio`) VALUES(?)");
  $sql = $dbh->query("SELECT `id` FROM `uploads` ORDER BY `id` DESC LIMIT 1");
  $id = $sql->fetchColumn();
  echo "play.php?id=$id";