60 $this->PageCSS =
get_package(
'page::page_css' ,
'last' , __FILE__ );
61 $this->PageJS =
get_package(
'page::page_js' ,
'last' , __FILE__ );
62 $this->Security =
get_package(
'security' ,
'last' , __FILE__ );
88 private function upload_plugins( $Path )
92 $this->PageJS->add_javascript( $Path.
'/include/plugins/swfupload.cookies.js' );
93 $this->PageJS->add_javascript( $Path.
'/include/plugins/swfupload.queue.js' );
94 $this->PageJS->add_javascript( $Path.
'/include/plugins/swfupload.speed.js' );
95 $this->PageJS->add_javascript( $Path.
'/include/plugins/fileprogress.js' );
96 $this->PageJS->add_javascript( $Path.
'/include/plugins/handlers.js' );
126 $Path =
'{http_host}/'._get_package_relative_path_ex(
'file_input::file_input_view' ,
'1.0.0' );
127 $this->PageJS->add_javascript( $Path.
'/include/swfupload.js' );
128 $this->upload_plugins( $Path );
129 $this->PageJS->add_javascript( $Path.
'/include/js/file_input_view.js' );
131 $this->PageCSS->add_stylesheet( $Path.
'/res/css/default.css' );
134 $Lang->include_strings_js(
'file_input::file_input_view' );
136 catch( Exception $e )
164 private function file_headers( $FileSize , $FileName )
168 header(
'HTTP/1.0 200 OK' );
169 header(
'Content-type: application/octet-stream' );
170 header(
"Content-Length: $FileSize" );
171 header(
"Content-Disposition: attachment; filename=\"$FileName\"" );
172 header(
'Connection: close' );
174 catch( Exception $e )
202 $Fid = $this->Security->get_gp(
'fid' ,
'integer' ,
false );
206 $FileInputAlgorithms =
get_package(
'file_input::file_input_algorithms' ,
'last' , __FILE__ );
207 $File = $FileInputAlgorithms->get_by_id( );
209 $FileSize = filesize(
get_field( $File ,
'file_path' ) );
210 $FileName =
get_field( $File ,
'original_file_name' );
212 $this->file_headers( $FileSize , $FileName );
214 readfile(
get_field( $File ,
'file_path' ) );
217 catch( Exception $e )
245 if( $Options->get_setting(
'download' ,
false ) )
252 catch( Exception $e )