How can i upload pdf or any type of file |
[eluser]Rumel[/eluser]
when i upload pdf file this time an error . pdf file is not uploaded. but jpg, gif file is uploaded. please help me .
[eluser]mvdg27[/eluser]
See the user guide here: http://ellislab.com/codeigniter/user-gui...ading.html and search for the'allowed_type' preference. Regards, Michiel
[eluser]Rumel[/eluser]
view page: <html> <head> <title>Upload Form</title> </head> <body> <?php echo $error;?> <?php echo form_open_multipart('basic/do_upload');?> <input type="file" name="userfile" size="20" /> <br /><br /> <input type="submit" value="upload" /> </form> </body> </html> my controller: function upload() { $this->load->view('upload_form', array('error' => ' ' )); } function do_upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png|pdf'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); $this->load->view('upload_form', $error); } else { $data = array('upload_data' => $this->upload->data()); $this->load->view('upload_success', $data); } } but not uploading pdf file. this code uploads jpg,gif,png file.how can i solve this problem please help me.
[eluser]mvdg27[/eluser]
Perhaps your PDF is larger than the allowed 100kb you have configured now? Code: $config[‘max_size’] = ‘100’;
[eluser]mbtshoes[/eluser]
view page: <html> <head> <title>Upload Form</title> </head> <body> <?php echo $error;?> <?php echo form_open_multipart(‘basic/do_upload’);?> <input type=“file” name=“userfile” size=“20” /> <input type=“submit” value=“upload” /> </form> </body> </html> my controller: function upload() { $this->load->view(‘upload_form’, array(‘error’ => ’ ’ )); } function do_upload() { $config[‘upload_path’] = ‘./uploads/’; $config[‘allowed_types’] = ‘gif|jpg|png|pdf’; $config[‘max_size’] = ‘100’; $config[‘max_width’] = ‘1024’; $config[‘max_height’] = ‘768’; $this->load->library(‘upload’, $config); if ( ! $this->upload->do_upload()) { $error = array(‘error’ => $this->upload->display_errors()); $this->load->view(‘upload_form’, $error); } else { $data = array(‘upload_data’ => $this->upload->data()); $this->load->view(‘upload_success’, $data); } } but not uploading pdf file. this code uploads jpg,gif,png file.how can i solve this problem please help me. mbt shoes ,mbt outlet,discount mbt shoes,cheap mbt shoes,mbt shoes sale
[eluser]Rumel[/eluser]
when i upload the pdf file this time show this error massage: The filetype you are attempting to upload is not allowed. please help me any one. |
Welcome Guest, Not a member yet? Register Sign In |