Welcome Guest, Not a member yet? Register   Sign In
Specifying an upload destination folder

I have been trying to make a script that allows me to specify a folder in which to upload my files(choose a destination folder in the view).I have tried all of my tricks and i cannot seem to get it right.Anybody?.

have you tried the move_uploaded_file function?

hi phpserver,

after calling the do_upload function you can
define the upload folder by:
$config['upload_path'] = './your_upload_folder/';

In your view you can place a dropdown and set the
values regarding to the folder names you want to switch
between (related to your root folder).

Just catch the dropdown value after calling the do_upload
function like this:
$destination_folder = $this->input->post('name_of_select_tag');
// and add:
$config['upload_path'] = './'.$destination_folder;

That should work at least if you hav only one level. In case
you need more folder levels you could set up an array with
all your possible folder structure destinations like
$upload_folders = ('uploads/folder1','uploads/folder2','uploads/folder1/images/');
// and so on
and set up the values of your dropdown according to the array indexes.

Thanks luckyfella,it works perfectly.

Theme © iAndrew 2016 - Forum software by © MyBB