I want to record the voice using html5 and I have tried jRecorder-jQuery too. From the document, it mentioned that the binary file is saved in browser cache. My question is where it? I have checked Chrome's cache but cannot see the temp file.
host (Mandatory): The PHP file http location where the recorded WAV file is posted.
That is from the jRecorder documentation(http://www.sajithmr.me/jrecorder/index.html), it seems that the file is not saved locally and is sent trough a post request to the mentioned php page on the host settings.
Add this in the jRecorder settings:
'host': 'acceptfile.php?filename=hello.wav'
And change the acceptfile.php to your php script that will handle the posted file.
Example php script for handeling the wav file(also from the documentation):
$upload_path = dirname(__FILE__). '/';
//here assume that filename parameter is passed. or your can write $filename= 'test.wav';
$filename = $_REQUEST['filename'];
$fp = fopen($upload_path."/".$filename.".wav", "wb");
fwrite($fp, file_get_contents('php://input'));
fclose($fp);
exit('done');
This script will save the audio file(wav) in the script folder.
Related
I have an email with a link to a video file stored on a cloud hosting service (backblaze)
I'm trying to make it so that when someone can clicks the link the file would start to download. Right now I have this:
Download Here
That takes you to the video instead of downloading the file. I'd like to avoid that if possible and have the link prompt you to start downloading the file when you click on it.
Is this possible to do in an email when the file is stored on a server somewhere?
Thanks
I think you can't do this in plain html.
Since you can't use JavaScript in email, the best option would be to manage to include some PHP script in the server that do the job.
This example was taken from serverfault
PHP
?php
// We'll be outputting a MP4
header('Content-type: video/mp4');
// It will be called downloaded.mp4
header('Content-Disposition: attachment; filename="downloaded.mp4"');
// Add your file source here
readfile('original.mp4');
?>
I am creating an application which requires slicing a video file (mp4 format) into chunks. Our server caps the upload_max_filesize at 2MB, but we have files that are hundreds of MBs in size which require uploading. So far I slice the file (into 1MB chunks) using HTML5 FileReader() then upload each chunk using ajax. (here is part of the function I have written)
reader.onload = function() {
$.ajax -> send current blob to server by method POST
};
blob = window.videoFile.slice(byteStart, byteEnd);
reader.readAsBinaryString(blob);
Here's the question: will concatenating the files (in order) on the backend then simply setting the Content-type as so:
header('Content-Type: video/mp4');
before saving the file actually reproduce the video file (i.e., perfectly not as some choppy second rate facsimile) or am I missing something here? This will require some time and the faster option may be for me to beg our server admin to alter the php.ini file to allow a much larger upload_max_filesize.
I want to save the source code for my website page into my computer. I know that I have to use an http request to download the source code for my web page into the computer as a html file. I want to run a diff to track changes between two html files for a web page. I am wondering how to implement a program to perform the function of saving a web page as an html file on my computer. Please help it is really appreciated. I want to solve the problem programatically. I was researching on this topic and found that httpget, and selenium scripts can achieve this task but I am struggling with the implementation.
With linux you can just use wget.
wget http://google.com
that will save a file called index.html on your computer.
Programmatically you can use python:
import urllib2
# create a list of urls that you want to download
urls = ['http://example.com', 'http://google.com']
# loop over the urls
for url in urls:
# make the request
request = urllib2.urlopen(url)
# make the filename valid (you can change this to suit your needs)
filename = url.replace('http://', '')
filename = filename.replace('/','-')
# write it to a file.
with open(filename + '.html', 'w') as f:
f.write(request.read())
I am making a webpage. I have to give link of a log file which is present on the server but that file is generated with a random number at the end.
I know the starting part of the filename. Here is my code -
Download log file Here
for example the name of the file is "log_parser2088.log" this 2088 number is randomly generated everytime the code runs and there is only one file in that folder which starts with the name "log_parser". I want to give reference to this file but this is not working.
HTML doesn't support this kind of references. Use PHP or ASP.NET for this task since these server side programms have access to the servers file system and can, f.e., read every filename in a directory.
Example for PHP:
// path to your log file directory
$directoryPath = "\\home\\logs\\";
// read all files from that directory
$files = scandir($directoryPath);
// print download link
foreach($path in $files)
echo("Download");
I have a web page that will be used to create KML Files with a perl script.I want the user to add some data to a form that will be used in my perl script. When the form is submitted it will run the script, create a kml file, then prompt the user to save the file. The only part I am not sure about is how to have the user save the file after the script has created the KML. Do I have the perl script prompt the download or use something on the HTML page prompt the download. I am not sure the best way to do this.
If you have a link or a form for telling the server to build the KML then just generate the KML normally and send it back to the browser with some extra HTTP headers. The headers you want are:
Content-disposition set to attachment;filename=whatever.kml where "whatever.kml" is what you want the file to be called.
Content-type set to application/vnd.google-earth.kml+xml.
The Content-disposition should tell the browser to download the KML instead of trying to handle it.
So the Perl script will be prompting the browser to prompt the download.
Assuming the contents of the kml file are in $kml then you'd want to do something like:
use CGI;
my $cgi = new CGI;
print $cgi->header('-Content-disposition' => 'attachment;filename=kml.xml',
'-Content-type' => 'application/vnd.google-earth.kml+xml');
print $kml;