I am creating an application that should download downloaded files and put them in separate directories for thumbnails and full-size images. But $ config ['upload_path'] = './uploads/'; only allows me to choose one download path. How to identify two or more download paths?
In fact, all you have to do is “reinitialize” the load class. Codeigniter does not allow you to call a class twice with new parameters (it ignores the second request), however you can say that the class manually loads the new parameters. Here is the basic information: (note the line "$ this-> upload-> initialized ($ config)". This is the key.
// this is for form field 1 which is an image.... $config['upload_path'] = './uploads/path1'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->upload->initialize($config); $this->upload->do_upload($fieild_1); // this is for form field 2 which is a pdf $config['upload_path'] = './pdfs/path2'; $config['allowed_types'] = 'pdf'; $config['max_size'] = '300'; $this->upload->initialize($config); $this->upload->do_upload($fieild_2);
I wrote the whole article about it here: http://taggedzi.com/articles/display/multiple-file-uploads-using-codeigniter
script, . , , . ( , ...)
, .
. .
, . :
/images/member/1 /images/member/2 /images/member/3
$config['upload_path'] = "/images/member/$user_id";
-, , . , $config ['upload_path'] , :
/images/member/1/resized /images/member/1/thumbnails
. , $config ['upload_path'] , .
( ) : CodeIgniter , 1 .
- .
Source: https://habr.com/ru/post/1763489/More articles:Как реализовать класс шаблона с зависимым от шаблона элементом сигнала от boost? - c++Is there a security issue when displaying a key value for users in a URL? - javaSounds muted on some phones - androidCriticizing a C # Hashmap Implementation? - hashmapError table "mysql.servers" does not exist - mysqlPerl module to get all pages of a website? - scriptingC #: convert T to T [] - genericsvcs plugin for vim? - vimSubdomains and folders / directories - pythondefine select dropdown with jquery $ (this) - jqueryAll Articles