Senin, 21 Oktober 2013

PHP Indonesia - Facebook: [CakePHP] gan kenapa ane upload file berhasil tapi...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Join Delanceyplace

Sign up to receive a free quote from a non fiction book every weekday.
From our sponsors
[CakePHP] gan kenapa ane upload file berhasil tapi...
Oct 21st 2013, 18:30, by Yayan Bin Kusman

Yayan Bin Kusman 6:30pm Oct 21
[CakePHP]
gan kenapa ane upload file berhasil tapi nama filenya gak masuk ke database ya, yang ke database malah array, mohon bantuannya,

ini script uploadnya

//upload
if ($this->request->is("post")) {
$uploadFolder = 'files' . DS . $id;
$uploadPath = $uploadFolder . DS;

if (!file_exists($uploadFolder)) {
mkdir($uploadFolder);
}
$filename = $this->data['Materi']['files']['name'];
if (move_uploaded_file($this->data['Materi']['files']['tmp_name'], $uploadPath.$filename)) {
$this->Materi->create();
if ($this->Materi->save($this->request->data)) {
$this->Session->setFlash("File telah terunggah");
} else {
$this->Session->setFlash("gagal");
}
}
}

http://pastebin.com/im2b1b2u

Mulia Nst 6:48pm Oct 21
Nama field di table apa gan?

Coba sebelum line 12 di pastebin, tambahin

$this->request->data['Materi']['field_untuk_simpan_nama_file'] = $filename;

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar