Today i was trying to install laravel in MAMP , While going through their step on laravel site mentioned i found that i didn installed mycript extension. I had googled for lot of time and lastly i installed .
I am writing this will help some one to install laravel in Mac using MAMP.
Install composer
Before installing laravel we have to install composer . We can go to https://getcomposer.org/ and we can install from from there or we can follow the following steps step
1. first we have to check curl is enabled . step 2. we can install composer globally as mentioned in their site
Today we are going to learn about force downloading prompt in PHP.
While i am doing my projects, i had a requirement for file download, File type will be changed, So i made a research on this and made simple useful script which can be use any where to prompt download by giving path and file name . Let us create a function download_file and pass full file path and filename , we can use third argument to mention the MIME Type of file
Next we are going to set mime type if we already pass the MIME type into function it will take that MIME ,else we are going to use a function pathinfo to retrieve the extension of file and we will compare with already created array to get content type
lastly we are going to read each line by line and print that as shown below.
$chunksize = 1 * (1024 * 1024);
$bytes_send = 0;
if ($sourceFile = fopen($sourceFile, 'r')) {
while (!feof($sourceFile) &&
(!connection_aborted())
) {
$buffer = fread($sourceFile, $chunksize);
print($buffer); // is also possible
flush();
}
fclose($sourceFile);
} else {
header("HTTP/1.1 505 Internal server error");
return;
}
That is it !!!!! Now we can have a look, How we can read the file using created function We can make a path file and the name we want to give while downloading and pass to function . It will download prompt for file. example for reading file and download prompt