Welcome Guest, Not a member yet? Register   Sign In
I can't seem to upload file types of css in codeigniter
#1

[eluser]codeigniterzzz[/eluser]
I'm using codeigniter 2.1.0. And I can't seem to upload file types of css. Here is the controller:

Code:
public function uploadcssfile()
{
   $config['upload_path'] = './stylesheets/stores/'.$memberid.'/';
   $config['file_name'] = 'main.css';    
   $config['allowed_types'] = 'css';  
   $config['overwrite'] = true;  
   $this->load->library('upload', $config);
   if (! $this->upload->do_upload('filefieldname'))
   {
     die($this->upload->display_errors());
   }
}

here is the html code:
Code:
<form action="<?php echo site_url('uploadcssfile'); ?>" enctype="multipart/form-data" method="post">
                            <input name="filefieldname" type="file" class="field1"/>
                            <input type="hidden" name="fx" value="uploadCSSfile"/>
                            <input type="submit" class="blogSaveBut" value="Upload CSS File">
                        </form>
#2

[eluser]yacman[/eluser]
Code:
if (! $this->upload->do_upload('filefieldname'))

You need to replace the 'filefieldname' with the actual Field Name of the input field for the file.
#3

[eluser]codeigniterzzz[/eluser]
which i did, thats the actual field name.
#4

[eluser]yacman[/eluser]
Please correct your posted code then to show the HTML which you are using now. It contains the field with the name of "uploaded".
Code:
name="uploaded"

In addition can you respond with the symptom. Where in the process of upload is it breaking down?
#5

[eluser]codeigniterzzz[/eluser]
ok updated.
#6

[eluser]yacman[/eluser]
You need to provide what's happening, the wire up code 'looks' ok. So what's the error, is the file going somewhere else, is there a php error being logged?

Turn on the CI Log in your config.php file and then tail the /application/logs/log-x-x.log file to see what's occurring.
#7

[eluser]Captain_Fluffy_Pants[/eluser]
all you have to do is
Code:
<link rel="stylesheet" href="url to src code" media="screen,projection" type="text/css" />
#8

[eluser]PhilTem[/eluser]
Where is $memberid defined? It is not defined before being called which results in an error resulting in failure of your upload because you got basically the following thing

Code:
$config['upload_path'] = './stylesheets/stores//';

which is no valid path.
#9

[eluser]Captain_Fluffy_Pants[/eluser]
create a subdomain to store js, css, and images in?
#10

[eluser]Captain_Fluffy_Pants[/eluser]
Code:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="domain.com/css/something.css" rel="stylesheet">
try that after your
Code:
<title></title>
tags?




Theme © iAndrew 2016 - Forum software by © MyBB