woony
Legacy Member
hello,
ik ben een multiple upload aan het maken met codeIgniter.
Nu loops enzo door mijn userfiles zijn allemaal geen probleem.
maar het volgende. mijn 1ste upload is een image , daar maak ik ook een thumb van etc, dus dit werkt, 2de file is een attachment file. en deze vraagt dus om een andere config.
Maar ik blijf fout krijgen:
The filetype you are attempting to upload is not allowed.
heb al geprobeerd eerst te initializen maar dat verhelpt het probleem precies ook niet.
iemand andere suggesties?
thx
-- krijg nu geen fouten meer...
juiste filename komt ook in database,
MAAR mijn file is niet geupped
niet naar de images map, noch naar de attachments map...
bij deze ook mijn functie eens.
ook even mijn functie:
ik ben een multiple upload aan het maken met codeIgniter.
Nu loops enzo door mijn userfiles zijn allemaal geen probleem.
maar het volgende. mijn 1ste upload is een image , daar maak ik ook een thumb van etc, dus dit werkt, 2de file is een attachment file. en deze vraagt dus om een andere config.
Maar ik blijf fout krijgen:
The filetype you are attempting to upload is not allowed.
heb al geprobeerd eerst te initializen maar dat verhelpt het probleem precies ook niet.
iemand andere suggesties?
thx
-- krijg nu geen fouten meer...
juiste filename komt ook in database,
MAAR mijn file is niet geupped

niet naar de images map, noch naar de attachments map...
bij deze ook mijn functie eens.
ook even mijn functie:
PHP:
function create()
{
$this->load->model('news_model');
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '3000';
$config['max_width'] = '3000';
$config['max_height'] = '2000';
$this->load->library('upload', $config);
$filecounter = 0;
foreach($_FILES as $key => $value)
{
$filecounter = $filecounter +1;
if($filecounter == 1)
{
if ( ! $this->upload->do_upload($key))
{
$errors = array('errors' => $this->upload->display_errors());
$this->load->view('news_maker', $errors);
}
else
{
$data = array('upload_data' => $this->upload->data());
$fInfo = $this->upload->data();
$this->_createThumbnail($fInfo['file_name']);
$data['uploadInfo'] = $fInfo;
$data['thumbnail_name'] = $fInfo['raw_name'] . '_thumb' . $fInfo['file_ext'];
$data['attachmentfile'] = "";
}
}
elseif($filecounter == 2) //second file is our attachment and is not necesarry
{
if($_FILES[$key]['name'] == "")
{
$config['upload_path'] = './attachments/';
$config['allowed_types'] = 'pdf';
$config['max_size'] = '5000';
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ( ! $this->upload->do_upload($key))
{
$errors = array('errors' => $this->upload->display_errors());
$this->load->view('news_maker', $errors);
}
else
{
$data['attachupload'] = $this->upload->data();
$aInfo = $this->upload->data();
$data['attachinfo'] = $aInfo;
$data['attachmentfile'] = $aInfo['raw_name'] . $aInfo['file_ext'];
}
}
else
{
$data['attachmentfile'] = "";
}
}
}
$newsdata = array(
'title' => $this->input->post('title'),
'date' => $this->input->post('datepicker'),
'poster' => $this->session->userdata('username'),
'text' => $this->input->post('content'),
'imageUrl' => $data["upload_data"]["file_name"] ,
'imageThumb' => $data['thumbnail_name'],
'partnerID' => $this->input->post('partners'),
'attachment' => $data["attachmentfile"]
);
$this->news_model->add_record($newsdata);
$this->index();
}