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

[eluser]phpserver[/eluser]
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?.
#2

[eluser]xwero[/eluser]
have you tried the move_uploaded_file function?
#3

[eluser]LuckyFella73[/eluser]
hi phpserver,

after calling the do_upload function you can
define the upload folder by:
Code:
$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:
Code:
$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
Code:
$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.
#4

[eluser]phpserver[/eluser]
Thanks luckyfella,it works perfectly.




Theme © iAndrew 2016 - Forum software by © MyBB