CodeIgniter Forums
File Upload - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: File Upload (/thread-27382.html)



File Upload - El Forum - 02-09-2010

[eluser]Unknown[/eluser]
Hello, Im currently doing a project that uses the file image class. I currently display a form with inputs and a file input. Now the user should not have to upload a given file when they edit this form all the time. Im wondering how to check to see if the user has submited a file and then check if file upload is sucessful and then process it?

ps - not a native english speaker


File Upload - El Forum - 02-09-2010

[eluser]eoinmcg[/eluser]
If your form input for the file was:
Code:
<input type="file" name="file"  />


Then you could do this
Code:
if($_FILES['file']['size'])
        {
            // do upload here
        }



File Upload - El Forum - 02-09-2010

[eluser]Unknown[/eluser]
[quote author="eoinmcg" date="1265745688"]If your form input for the file was:
Code:
<input type="file" name="file"  />


Then you could do this
Code:
if($_FILES['file']['size'])
        {
            // do upload here
        }
[/quote]

In the do upload here can i use the code ignighter file upload class?


File Upload - El Forum - 02-09-2010

[eluser]eoinmcg[/eluser]
yeah, you'll need to load it there, if you haven't done so already.