Welcome Guest, Not a member yet? Register   Sign In
uploading on subfolders
#1

[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?
#2

[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.
#3

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

[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
#5

[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..




Theme © iAndrew 2016 - Forum software by © MyBB