Getting uploadify to work |
[eluser]pickupman[/eluser]
Not quite sure what you are trying to explain, but in my previous post, using the javascript onComplete callback to be able to use CI built in functions. Be sure to read my example posted above and check out the Uploadify documentation.
[eluser]pickupman[/eluser]
I finally got a chance to work on the new version 2 of uploadify. The zip file contains the uploadify source, controller file, and 2 views. Download the source. This contains the basic functionality of being able to upload a file then process it using CI. I posted more information about as well.
[eluser]Mousa[/eluser]
Hi guys, i know whats the problem. the problem is the file type which flash set it as "application/octet-stream", so what this means? we should know the process of CI Upload Class to Upload a file. CI Upload Class validate file type, through extension of the file and its mime. if you take a look at CI/application/config/mimes.php, so you can see CI`s mime refrence to validate file types. so, whats the solutions? 1- (simplest one) open CI/system/libraries/Upload.php and go to line 552, then replace this method : Code: function is_allowed_filetype() or you can override this method with MY_Upload class. its your choice. 2- add "application/octet-stream" to the type of files you want to upload open CI/application/config/mimes.php and add the "application/octet-stream" to files you want. 3- change the flash file to send the appropriate file type. so , the problem is not CI, the Problem is not CI clean urls, or the limitations of get requests. i think this way is better than using external scripts and break ci process, so you can upload files with ci approach,validate users and process images. good Luck
[eluser]pickupman[/eluser]
Good point.I guess I had forgotten about adding the filetypes in the mime.php. I had done that awhile back. It's best not to modify the core functions or files of CI. The best approach is just add them to the arrays in mime.php. Here is my copy with most of the commonly upload filetypes added.
[eluser]Mousa[/eluser]
[quote author="pickupman" date="1255112241"]Good point.I guess I had forgotten about adding the filetypes in the mime.php. I had done that awhile back. It's best not to modify the core functions or files of CI. The best approach is just add them to the arrays in mime.php. Here is my copy with most of the commonly upload filetypes added.[/quote] your right. but if you use upload class in various places in your application, and each place, upload an specific file type(eg. somewhere pdf, somewhere images, somewhere documents) you should add "application/octet-stream" in every file type in mimes.php. and notice that, the flash uploader set every file type to "application/octet-stream", so it`s better to override the core class with MY_Upload. but its my idea. everyone have different ideas and different solutions. good luck.
[eluser]nmormino[/eluser]
I've gotten uploadify working just fine with CodeIgniter. That part was easy, the part I'm working on now, is making it tie into the CI sessions. Anyone have any ideas on that?
[eluser]pickupman[/eluser]
If you were authenticating a user to allow uploading, do this in the controller before you display the form to them. If you are looking to associate a upload to a user id or something along that lines, the key lies in the onComplete javascript callback from uploadify. I use Code: $.post('<?php echo site_url("upload/uploadify");?>',{filearray:response},function(imageForm){
[eluser]Unknown[/eluser]
I've been struggling for couple of hours these days with fitting my Uploadify in CodeIgniter. All the code above here became a little messy by having more examples in 1 topic. Is there an example which works for multi-upload in CodeIgniter ? Regards, MStichel ==EDIT== Ok, I managed to get it working, finally ![]()
[eluser]imaffett[/eluser]
[quote author="nmormino" date="1255563482"]I've gotten uploadify working just fine with CodeIgniter. That part was easy, the part I'm working on now, is making it tie into the CI sessions. Anyone have any ideas on that?[/quote] Hey Noah, hope all is well going for you guys. I ran into this problem recently with another uploader. The issue is Flash is making the request and not your browser, so the session isn't carried over. I'm not 100% sure how uploadify works, but you can just pass additional parameters in the form submission url. What I would do is create a file on the server that has the user info you want (like their id and other session info as a serialized array), and then pass the file name as a token in the URL (the form it submits to is good enough). You can then use this to authenticate against a central auth database or anything to verify it's valid. After the main page submits, you can then clean out the file you created, or just store them in a folder that gets purged every so often (like /tmp/). Just make sure you don't try deleting it after each request and wonder why the first one only works.
[eluser]dinhtrung[/eluser]
I extended CI_Upload class to support this issue. I think modify the config/mimes is such a time consuming work, because for one page, you allow text, for another, you allow images, but you must modify both filetypes in the mime config. So I create MY_Upload class: Code: <?php |
Welcome Guest, Not a member yet? Register Sign In |