zend framework2 - Rackspace saving file in text formats -
using zend framework 2 , saving files cloud using "zendservice-rackspace", here code saving file. code saving file in text format when go link show text format, not image or pdf format of file
$filename = $filename.'_'.date('ymd-his').".".$fileext; $filedata = file_get_contents($file['tmp_name']); $rackspace = new files($user,$key); if ($rackspace->authenticate()) { $rackspace->storeobject('photos', $filename, $filedata); if ($rackspace->issuccessful()) { $cdninfo = $rackspace->getinfocdncontainer($module); $url = $cdninfo['cdn_uri_ssl'] . '/' . $filename; return $url; } else{ echo json_encode(array( 'success'=>true, 'msg'=>'file uploading failed server')); exit; }
Comments
Post a Comment