Function for download file links with php -
i want add function download files uploaded other day. not handy php dont know how add function , generate link listed files @ time.
here php code:-
// destination folder downloaded files $date = date('m.d.y'); mkdir("uploads/" . $date, 0777, true); $upload_folder = 'uploads/' . $date; // if browser supports sendasbinary () can use array $ _files if(count($_files)>0) { if( move_uploaded_file( $_files['upload']['tmp_name'] , $upload_folder.'/'.$_files['upload']['name'] ) ) { echo 'done'; } exit(); } else if(isset($_get['up'])) { // if browser not support sendasbinary () if(isset($_get['base64'])) { $content = base64_decode(file_get_contents('php://input')); } else { $content = file_get_contents('php://input'); } $headers = getallheaders(); $headers = array_change_key_case($headers, case_upper); if(file_put_contents($upload_folder.'/'.$headers['up-filename'], $content)) { echo 'done'; } exit(); }
Comments
Post a Comment