Welcome Guest, Not a member yet? Register   Sign In
need help for upload samo files
#1

[eluser]Unknown[/eluser]
hi all i want to upload video files but i have some problem here, that is when i choose video file page just be refreshed else going to end

view file code

<?php
echo '<xmp>';
print_r( $data );
echo '</xmp>';
echo form_open_multipart( site_url('upload/index') ) ;
echo validation_errors();
echo form_upload('file') ;
echo form_hidden(array( 'name' => 'filename' , 'value'=> 'sad'));
echo form_submit('submit' , 'upload') ;
echo form_close();


controller file code


class Upload extends CI_Controller {

public function index(){
$output['data'] = '';

if( $this -> input -> post('submit' , FALSE) ){

$file = 'video_file';
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'jpg|gif|png|wmv|mp3|mov|avi|mp4|mpeg|mpg|qt|movie|mpe|mkv|zip|rar|7z';
$config['encrypt_name'] = TRUE;

$data = $this->load->library('upload', $config);

if ( ! $this->upload->do_upload('file') ){
$output['data'] = $this->upload->display_errors();
print_r($output);
die();
$this -> load -> view('uplaoderror' , $output);
}else{
$output['data'] = $this->upload->data() ;
print_r($output);
die();
$this -> load -> view('uploadok' , $output);
}
}else{
$this->load->view('form' , $output);
}
}
}

problem is in line i check submit, when i am choosing video file in will return false in other case like mp3 or jpg will return true some tell me what is cause please ?!





Theme © iAndrew 2016 - Forum software by © MyBB