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
// client side upload | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data")); // i guess it's the default | |
curl_setopt($ch, CURLOPT_URL, 'http://url/to/upload'); | |
curl_setopt($ch, CURLOPT_POST, true); | |
$file = curl_file_create('/path/to/your/file.zip'); | |
$post = array('anyParameterYouNeed' => 'anyValue', 'fileArrayIndexOnServer' => $file); | |
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $postData); | |
curl_exec($ch); | |
// and on the server side it looks like this |
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
$fh = fopen('/your/target/file', 'w'); | |
curl_setopt($ch, CURLOPT_FILE, $fh); | |
curl_setopt($ch, CURLOPT_HTTPGET, true); | |
curl_setopt($ch, CURLOPT_URL, 'http://your/download/url'); | |
curl_exec($ch); | |
// revert it | |
curl_setopt($this->ch, CURLOPT_FILE, STDOUT); | |
fclose($fh); // don't forget to close the handle |
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
app.directive('contenteditable', function() { | |
return { | |
restrict: 'A', | |
require: '?ngModel', | |
link: function(scope, element, attrs, ngModel) { | |
if(!ngModel) | |
return; | |
// model -> view | |
ngModel.$render = function() { | |
element.html(ngModel.$viewValue); |