Username Password

Lost Password
View Thread
Explore Your Brain » Pemrograman » PHP
[SOLVE] codeigniter: uploading file
Username
Password
Register FAQ Members List Today's Posts Search

Print Thread

09-04-2012 06:37 AM [SOLVE] codeigniter: uploading file | Edited by letsmove 11-04-2012 01:44 AM
User Avatar

letsmove
Murid Akademi II


Posts: 39
Joined: 13.07.09

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29
masta masta, mohon bantuannya ya. saya sedang belajar upload file menggunakan codeigniter

error yang saya dapatkan adalah seperti ini:

"The upload path does not appear to be valid."

dan inilah script asli yang ada di dokumentasi codeigniter

letak: view/upload_form.php

Download source  Code
<html>
<head>
<title>Upload Form</title>
</head>
<body>

<?php echo $error;?>

<?php echo form_open_multipart('upload/do_upload');?>

<input type="file" name="userfile" size="20" />

<br /><br />

<input type="submit" value="upload" />

</form>

</body>
</html>





Letak : view/upload_success.php

Download source  Code
<html>
<head>
<title>Upload Form</title>
</head>
<body>

<h3>Your file was successfully uploaded!</h3>

<ul>
<?php foreach ($upload_data as $item => $value):?>
<li><?php echo $item;?>: <?php echo $value;?></li>
<?php endforeach; ?>
</ul>

<p><?php echo anchor('upload', 'Upload Another File!'); ?></p>

</body>
</html>




dan ini controllernya: controller/upload.php

Download source  Code
<?php

class Upload extends CI_Controller {

   function __construct()
   {
      parent::__construct();
      $this->load->helper(array('form', 'url'));
   }

   function index()
   {
      $this->load->view('upload/upload_form', array('error' => ' ' ));
   }

   function do_upload()
   {
      $config['upload_path'] = './uploads/';
      $config['allowed_types'] = 'gif|jpg|png';
      $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/upload_form', $error);
      }
      else
      {
         $data = array('upload_data' => $this->upload->data());

         $this->load->view('upload/upload_success', $data);
      }
   }
}
?>





dan untuk struktur kode yang saya buat adalah seperti berikut

+application
+css
+image
+system
+uploads

:?plz? :hlp
i dont wanna move slow
 
Offline
09-04-2012 09:19 AM RE: [SOLVE] codeigniter: uploading file
User Avatar

EVA-00
HackAge


Posts: 2768
Joined: 21.05.08
Location: Wallahu a'lam
Age: 33
Hak akses direktori /upload & sub foldernya udah di set 777 blm?
Nabi Muhammad SAW bersabda :” Barangsiapa Yang Mengamalkan Ilmu Yang Ia Ketahui Maka Allah Akan Memberikan Kepadanya Ilmu Yang Belum Ia Ketahui” (HR. Imam Ahmad).

..::shn6 u!vJq Jnoh 3Joldx3 d33>I::..
 
Offline
10-04-2012 11:14 PM RE: [SOLVE] codeigniter: uploading file | Edited by letsmove 10-04-2012 11:15 PM
User Avatar

letsmove
Murid Akademi II


Posts: 39
Joined: 13.07.09

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29
udah tapi belum bisa juga masih error.

Download source  Code
chmod -vR 777 docclassifier/upload





oh iya lupa kasih info os nya. saya menggunakan ubuntu 10.10
i dont wanna move slow
 
Offline
11-04-2012 01:43 AM RE: [SOLVE] codeigniter: uploading file
User Avatar

letsmove
Murid Akademi II


Posts: 39
Joined: 13.07.09

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29

Deprecated: Function eregi() is deprecated in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 24

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/explnorg/public_html/includes/bbcodes/code_bbcode_include.php on line 29
yes, udah ketemu masalahnya masta, ternyata pas dibagian ini:

Download source  Code
$config['upload_path'] = 'uploads';
      $config['allowed_types'] = 'gif|jpg|png';
      $config['max_size']   = '100';
      $config['max_width']  = '1024';
      $config['max_height']  = '768';

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




perlu ditambahkan code seperti ini

Download source  Code
$this->upload->initialize($config);




jadinya :

Download source  Code
<?php

class Upload extends CI_Controller {

   function __construct()
   {
      parent::__construct();
      $this->load->helper(array('form', 'url'));
   }

   function index()
   {
      $this->load->view('upload/upload_form', array('error' => ' ' ));
   }

   function do_upload()
   {
      $config['upload_path'] = 'uploads';
      $config['allowed_types'] = 'gif|jpg|png';
      $config['max_size']   = '100';
      $config['max_width']  = '1024';
      $config['max_height']  = '768';

      $this->load->library('upload', $config);
                $this->upload->initialize($config);
                                           
               
               
      if ( ! $this->upload->do_upload())
      {
                        $cek = var_dump(is_dir('./uploads'));
         $error = array('error' => $this->upload->display_errors());

         $this->load->view('upload/upload_form', $error,$cek);
      }
      else
      {
         $data = array('upload_data' => $this->upload->data());

         $this->load->view('upload/upload_success', $data);
      }
               
   }
}
?>





thanks to codeigniter forum.
i dont wanna move slow
 
Offline
Jump to Forum:
Forum powered by fusionBoard
Share this Thread
URL:
BBcode:
HTML:
Similar Threads
Thread Forum Replies Last Post
Php and MySQL jadi file installer(Exe) PHP 2 18-07-2014 21:15
Autorun or pnp at Framework CodeIgniter PHP 3 14-09-2013 18:59
[help] upload file to different server PHP 6 30-01-2013 21:13
Read This Before You Start File Sharing Pengumuman 1 08-12-2012 09:50
ASK : FTP (file transfer protocol) beda DOMAIN Out Of Topic 1 02-05-2012 19:37
Copyright © 2007-2016