setopt(CURLOPT_FOLLOWLOCATION, true) ; if(empty($url)) { $array['err'] = "No url specified"; echo json_encode($array); exit(); } //Checking File size if(!is_numeric($curl->file_size) || $curl->file_size == '') { $array['err'] = "Unknown file size"; echo json_encode($array); exit(); } if(isset($_POST['check_url'])) { $array['size'] = $curl->file_size; $array['ext'] = $ext; echo json_encode($array); exit(); } //Get File Extension //Get File Name //$file_name = time(); $file_name = $_POST['file_name']; $file_path = TEMP_DIR.'/'.$file_name.'.'.$ext; //Opening File $file = fopen($file_path,"w"); //Reading Content $content = $curl->exec(); //writing File fwrite($file,$content); $Upload->add_conversion_queue($file_name.'.'.$ext); if ($theError = $curl->hasError()) { $array['err'] = $theError ; echo json_encode($array); } //Closing Curl Session $curl->close() ; echo "done"; ?>