CodeIgniter Forums
upload problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: upload problem (/showthread.php?tid=18099)



upload problem - El Forum - 04-25-2009

[eluser]timaksu[/eluser]
so i went ahead and followed this http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.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?


upload problem - El Forum - 04-25-2009

[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


upload problem - El Forum - 04-25-2009

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


upload problem - El Forum - 04-25-2009

[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



upload problem - El Forum - 04-25-2009

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



upload problem - El Forum - 04-27-2009

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


upload problem - El Forum - 04-27-2009

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



upload problem - El Forum - 04-27-2009

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