Note that there are some explanatory texts on larger screens.

plurals
  1. POMerge mp3 files into one and then save in a folder using php
    primarykey
    data
    text
    <p>I am new to PHP .I want to merge mp3 files into one mp3 file.i googled this query and found this code .It is working fine and give me back the merged file. But this code give me merged file as save file .but i want to save the merged file in a folder .so that i can give the URL of the file to some application.</p> <pre><code>class mp3{ var $str; var $time; var $frames; // Create a new mp3 function mp3($path="") { if($path!="") { $this-&gt;str = file_get_contents($path); } } // Put an mp3 behind the first mp3 function mergeBehind($mp3){ $this-&gt;str .= $mp3-&gt;str; } // Calculate where's the end of the sound file function getIdvEnd(){ $strlen = strlen($this-&gt;str); $str = substr($this-&gt;str,($strlen-128)); $str1 = substr($str,0,3); if(strtolower($str1) == strtolower('TAG')){ return $str; }else{ return false; } } // Calculate where's the beginning of the sound file function getStart(){ $strlen = strlen($this-&gt;str); for($i=0;$i&lt;$strlen;$i++){ $v = substr($this-&gt;str,$i,1); $value = ord($v); if($value == 255){ return $i; } } } // Remove the ID3 tags function striptags(){ //Remove start stuff... $newStr = ''; $s = $start = $this-&gt;getStart(); if($s===false){ return false; }else{ $this-&gt;str = substr($this-&gt;str,$start); } //Remove end tag stuff $end = $this-&gt;getIdvEnd(); if($end!==false){ $this-&gt;str = substr($this-&gt;str,0,(strlen($this-&gt;str)-129)); } } // Display an error function error($msg){ //Fatal error die('&lt;strong&gt;audio file error: &lt;/strong&gt;'.$msg); } // Send the new mp3 to the browser function output($path){ //Output mp3 //Send to standard output if(ob_get_contents()) $this-&gt;error('Some data has already been output, can\'t send mp3 file'); if(php_sapi_name()!='cli'){ //We send to a browser header('Content-Type: audio/mpeg3'); if(headers_sent()) $this-&gt;error('Some data has already been output to browser, can\'t send mp3 file'); header('Content-Length: '.strlen($this-&gt;str)); header('Content-Disposition: attachment; filename="'.$path.'"'); } echo $this-&gt;str; return ''; } } // First File: (Google speech) $mp3 = new mp3('1.mp3'); $mp3-&gt;striptags(); //Second file $second = new mp3("2.mp3"); $mp3-&gt;mergeBehind($second); $mp3-&gt;striptags(); $mp3-&gt;output('word.mp3'); //Output file (current a blank file) </code></pre> <p>The solution code will be very appreciate able ..Thanks in advance </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload