CodeIgniter Forums

Full Version: upload problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]timaksu[/eluser]
so i went ahead and followed this http://ellislab.com/codeigniter/user-gui...ading.html and got uploading to work. its nice and easy. gotta love CI lol. problem is, i cant access my images when i navigate to localhost/codeigniter/uploads/imagename.gif

im guessing this is because i have the rewrite stuff happening (remove index.php), and its trying to access the uploads controller?

well how do i access the images then?

El Forum

[eluser]Dam1an[/eluser]
You'd have to build a controller with a view function which takes the name of the image as an argument
You ould then pass this to your view which would use the standard HTML img tag to display it

El Forum

[eluser]timaksu[/eluser]
can you quickly help me get that working? what would that look like? i know the constructor will be need to be called 'uploads' but what about the functions? wouldnt going to an image (say, image.gif) call the image.gif funtion in the uploads constructor?

El Forum

[eluser]pistolPete[/eluser]
[quote author="tidus97" date="1240702866"] cant access my images when i navigate to localhost/codeigniter/uploads/imagename.gif
im guessing this is because i have the rewrite stuff happening (remove index.php)[/quote]
Please post your .htaccess file.
You probably need something like this:
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

El Forum

[eluser]timaksu[/eluser]
Code:
RewriteEngine on
RewriteRule ^$ /codeigniter/index.php [L]

RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)

RewriteRule ^(.*)$ /codeigniter/index.php/$1 [L]

El Forum

[eluser]timaksu[/eluser]
sorry but bump?

El Forum

[eluser]TheFuzzy0ne[/eluser]
You'r htaccess file should be in the same directory as your index.php.

Code:
RewriteEngine on

RewriteCond %{REQUEST_URI} !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]

El Forum

[eluser]timaksu[/eluser]
that doesnt work.. >_<