Last active
November 26, 2019 02:24
-
-
Save rogeriotaques/e39ad9303f0e84929c8a498455cba4ab to your computer and use it in GitHub Desktop.
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 | |
public function uploadFileFromBlobString($base64string = '', $file_name = '', $folder = '') | |
{ | |
$file_path = ""; | |
$result = 0; | |
// Convert blob (base64 string) back to PDF | |
if (!empty($base64string)) { | |
$base64data = base64_decode($base64string, true); | |
$file_path = "{$folder}/{$file_name}"; | |
// Return the number of bytes saved, or false on failure | |
$result = file_put_contents("{$this->_assets_path}/{$file_path}", $base64data); | |
} | |
return $result; | |
} // uploadFileFromBlobString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment