[eluser]Philo01[/eluser]
Hi there!
I'm trying to get Uploadify work with the codeigniter upload class.
If I manualy code it like:
Code:
<?php
$tempFile = $_FILES['userfile']['tmp_name'];
$targetFile = './uploads/'.$_FILES['userfile']['name'];
move_uploaded_file($tempFile,$targetFile);
?>
That works, but I prefer to get it working with the normal file uploading class.
So this is my attempt:
Code:
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'jpg';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
echo "0";
}
else
{
$data = array('upload_data' => $this->upload->data());
echo "1";
}
$myFile = "./log.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $this->upload->display_errors().' '.$_FILES['userfile']['name'];
fwrite($fh, $stringData);
fclose($fh);
As you can see, I write any errors and the filename to my log.txt file.
Now when I try to upload something, I will get the following error:
Quote:<p>The filetype you are attempting to upload is not allowed.</p> test.jpg
It throws me that error all the time, while the fileext is set to jpg in the "allowed_types" part.
Anyone who can help me out

?
Thanks!
Philo