Archives
Recent comments
- In File uploading, file storage and CakePHPs MediaView class
- sebb86 wrote: $this-set('path', APP . 'media' . DS . $media['Media']['path']); I think the path is only the...
- In File uploading, file storage and CakePHPs MediaView class
- sebb86 wrote: Hello again ;) Could you write an example for this? e.g.: link(... Thanks!
Categories
Words of Wisdom from Florian Krämer
-
File uploading, file storage and CakePHPs MediaView class
January 25 2010 | Florian Krämer | CakePHP, Uncategorized
This article includes how to upload and store files, because I've seen a lot of discussion about that too, but if you're just interested in how to use the MediaView class scroll down. Handling file uploads in CakePHP First let's start with the required form, to create a file upload form all you have to do is this: The "type" in the options of Form::create() takes post, get or file. To configure the form for file uploading it has to be set to file which will render the form as a multipart/form-data form. When you submit the form now, you'll get data like this in $this->data of your controller: Ok, now the big question with a simple answer is where the file data should be processed, guess where. Right – in the model because it's data to deal with and validation to do against it. Because it's a recurring task to upload files I suggest you to write a behaviour for it or conver...[ Read More | 0 Comments ]