I have a import file page that has a form with a file input element in it, when the user clicks submit, it sends the file, with a JSON document, to a url which uses PHP to read the file and processes it, then inserts the data into a MySQL database.
My question is, what is the best way to go about handling this import feature on the import page(the user-facing interface)? The technologies I am able to use are, Javascript with jQuery for the import file page, and PHP with Codeigniter for the api for serverside processing.
So far, I read people recommending work arounds using iframes, or HTML5 File Api. Is there a better/safer/easier way to go about creating the file upload feature?
As for usability, for latest browsers i would advice is to use drag & drop upload functionality (that's really cool!) with "old-fashioned" ajax file transfer fallback for old browsers, that is based on flash.
Look at this jQuery plugin for example: http://blueimp.github.com/jQuery-File-Upload/
As for security, i would advice to check file mime type if it is possible (if you have PHP fileinfo extension) with PHP. Unfortunately, i am not familiar with Codeigniter (i use ZF), but i am sure that Codeigniter has filters/validators for files.
Form validation in CI: