CodeIgniter Forums
uploading on subfolders - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: uploading on subfolders (/showthread.php?tid=26142)



uploading on subfolders - El Forum - 01-07-2010

[eluser]radd[/eluser]
Hi guys,
I'm new here and here's my dull question:

Running CI on my localhost using XAMPP and I'm trying to upload images on a 'uploads' folder but in subfolders (ie. each user has it's own subfolder of uploaded images and thumbs).

SAMPLE:
Code:
$id = $this->session->userdata('id');
$config['upload_path'] = 'uploads/'.$id.'/';

But when I run this, I get a: The upload path does not appear to be valid.
How should I do it?


uploading on subfolders - El Forum - 01-07-2010

[eluser]rogierb[/eluser]
Hi and welcome.

First of all be sure the path exists with is_dir() of file_exists(). If not, create it. If it gets created somewhere you don't expect it, your path is wrong.

Assuming the upload dir is in your root, use APPATH.'uploads/'.$id.'/'; for both checking and uploading.

Also, make sure the webserver is allowed to create and write the dir.


uploading on subfolders - El Forum - 01-09-2010

[eluser]paulon[/eluser]
how to create and delete a file directory?


uploading on subfolders - El Forum - 01-09-2010

[eluser]richfearless[/eluser]
to create a directory use
Code:
mkdir('path/to/folder/you/wish/to/create'/);

to delete a directory use
Code:
rmdir('path/to/folder/you/wish/to/remove'/);

hope this helps


uploading on subfolders - El Forum - 01-09-2010

[eluser]paulon[/eluser]
tnx it help..
but what if i want to delete a folder that has a file in it? it gives me a validation error..