CodeIgniter Forums

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

El Forum

[eluser]Unknown[/eluser]
hi
im new in codeigniter
and i like it to much
im trying to do some website have users and news
but have some problem with uploading
like:

when user write news he can upload pic if he wants and i can do it perfect
but if he dosent want to upload pic it show message say "You did not select a file to upload."
ok i dont want show message i want to continue and insert news without pic

i'll give u example :

this's form and have :
title
news
pic --> this is uplad file


ok i need pic not required field
how to do that?


hope u understnad me, cuz im not very will in engish

thx alot

El Forum

[eluser]Zeeshan Rasool[/eluser]
I understood what are u trying to say bro ;-) ,
Ok can you show your code , if this message comes thru javascript then show me your client side validated function Or if this check is in your controller then show here that function.
Without showing the function its hard to say something

Cheers,

El Forum

[eluser]pistolPete[/eluser]
You can try this:
Code:
// check if user sent a file
if(!empty($_FILES['userfile']['name']))
{
    // process the file using the upload library
    $this->upload->do_upload();
}