Use the following configuration in Apache's httpd.conf file or within a virtual host configuration. Note that you should set DocumentRoot
and ServerName
fit to your environment:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function show($str){ | |
echo $str . "<br/>\n"; | |
flush(); | |
ob_flush(); | |
} | |
$archiveDir = "temp"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/*ini settings*/ | |
set_time_limit(0); | |
ini_set('memory_limit', '512M'); | |
//DOWNLOAD SCRIPT | |
$filePath = "G:/Software/versions/..PATH TO DOWNLOAD FILE...zip"; // set your download file path here. | |
download($filePath); // calls download function | |
function download($filePath) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ftp_sync - copy directory and file structure | |
// based on http://www.php.net/manual/es/function.ftp-get.php#90910 | |
// main function witch is called recursivly | |
function ftp_sync($dir, $conn_id) { | |
if ($dir !== '.') { | |
if (ftp_chdir($conn_id, $dir) === FALSE) { | |
echo 'Change dir failed: ' . $dir . PHP_EOL; | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP File download function. | |
* Version 1.4 | |
* | |
* Copyright (c) 2014 성기진 Kijin Sung | |
* Modified by ssut | |
* | |
* License: MIT License (a.k.a. X11 License) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param $url | |
*/ | |
public function actionStreamVideoFromCdn($url) | |
{ | |
$headersCollection = Yii::$app->request->getHeaders(); | |
$responseHeaders = []; | |
$chInfo = curl_init(); | |
curl_setopt($chInfo, CURLOPT_URL, $url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get all users | |
var url = "http://localhost:8080/api/v1/users"; | |
var xhr = new XMLHttpRequest() | |
xhr.open('GET', url, true) | |
xhr.onload = function () { | |
var users = JSON.parse(xhr.responseText); | |
if (xhr.readyState == 4 && xhr.status == "200") { | |
console.table(users); | |
} else { | |
console.error(users); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// browser detect | |
var BrowserDetect = { | |
init: function(userAgent, appVersion) { | |
this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; | |
this.version = this.searchVersion(userAgent) || this.searchVersion(appVersion) || "an unknown version"; | |
this.OS = this.searchString(this.dataOS) || "an unknown OS"; | |
}, | |
searchString: function(data) { | |
for (var i = 0; i < data.length; i++) { | |
var dataString = data[i].string; |
A modified version of this codepen: http://codepen.io/pankajparashar/pen/towxF
Now accounts for:
- adding
z-index
property to the<progress>
element - subtracts additional
<footer>
element's height from progress calculation (in thegetMax()
method)
This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create()
can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.
- This sample uses gapi.
- Before you use this, please enable Drive API at API console and carry out the installation of gapi.
- When this script is run, a text file including "sample text" is created to Google Drive.
- When you use this script, please set fileContent and metadata.
In this sample script, a text file including contents is created under a folder.
OlderNewer