⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

uploading a file and what is jquery_ui?



richb201
  • profile picture
  • Member

Posted 09 December 2017 - 20:58 PM

I took a look at the documentation for set_field_upload() and I am not sure that this is what I think it is. I copied this code from the examples:

 

$crud->set_field_upload('file_url','assets/uploads/files');
$this->config->set_item('grocery_crud_file_upload_allow_file_types', 'xls');

 

This seems to allow a field in my database to be the upload filename. Not exactly what I need. 

I want a user to be able to have a user upload an excel file and I want to import it into the CRUD (or the table).  I just don't see an example of this in the docs. 

 

I also see the jquery_ui() function. What is this for? Is there any example? I'd like to use a Jquery Widget in one part of my code. Are there any examples of the use of this? Am I better off looking at Codeigniter for these situations? 

 

thx


Amit Shah
  • profile picture
  • Member

Posted 11 December 2017 - 04:46 AM

Well - my friend, very one thing, you don't expect every solution to be part of the library :)... But the library is very flexible. You just need to think up on the solution.

 

Anyways, what you looking in for is to import the excel inside a table, now that piece of code you have to write it on your own. As for the file upload functionality works fine - it accepts the file, uploads it and stores the name of uploaded file in the field. What you can do is - use callback_after_inseert (this will ensure that the user have uploaded the file and also saved the record). In the callback, you can do your magical code of opening the xls file and importing in the table as you like. Let that file name be there as the one in the field, you can either ignore the same or you can just delete the file and remove the value from the field.

 

Do as you please out there, do your magic stuff.

 

Happy GCing :)


richb201
  • profile picture
  • Member

Posted 11 December 2017 - 14:55 PM

I found the example. It seems to allow a certain field to be made into a link for uploading by clicking on the field. In my case, I want to upload an entire list of data. So the file name to upload is not in the table. I've seen a bunch of examples how to get the data into the table and that is OK. My question concerns how to upload the file. 

 

 

crud->set_field_upload('file_url','assets/uploads/files');
$this->config->set_item('grocery_crud_file_upload_allow_file_types', 'xls');

 

Since I don't have a field that contains a filename to upload, how do I do this?Is there some work around? 


Amit Shah
  • profile picture
  • Member

Posted 11 December 2017 - 17:12 PM

u have to have a field name.. thats for sure for field upload functionality.