Welcome Guest, Not a member yet? Register   Sign In
Getting uploadify to work
#91

[eluser]y0rkez[/eluser]
Thank you pickupman your script is really helpful and it's running, but I have to a little modify for the script and it's done.
Thank you so much, it's a great work. :-)
#92

[eluser]pickupman[/eluser]
Thanks. I've got a lot of use out of this myself, as I have used it on 6-7 sites. Sometimes requires a little tweaking depending on server environment.
#93

[eluser]y0rkez[/eluser]
I have one question, if I have submitted a file and success then I wanna load this file in a div using ajax after this code executed
Code:
'onComplete'   : function (event, queueID, fileObj, response, data) {
                                $.post('controller',{json_array: response},function(info){
                                $("#target").append(info);  //Add response returned by controller
                                });                                            
                            }
Could you give tutor to put down the function of ajax?
Thank you...
#94

[eluser]pickupman[/eluser]
Quote:'onComplete' : function (event, queueID, fileObj, response, data) {
$.post('controller',{json_array: response},function(info){
$("#target").append(info); //Add response returned by controller
});
}

You can try this in your controller. Add
Code:
function uploadify()
    {
        $file = $this->input->post('filearray');
        $json = json_decode($file);

        $user_id = $this->session->userdata('user_id');
        //Add media to DB
        $insert = array(
            'file_name' => $json->{'file_name'},
            'file_date' => date("Y-m-d H:i:s"),
            'file_type' => $json->{'file_ext'},
            'file_size' => $json->{'file_size'},
            'user_id' => $user_id);
            
        $this->db->insert('file', $insert);
        $file_id = $this->db->insert_id();


        $this->load->library('table');
        $this->table->set_heading('Filename', 'Filesize', 'Filetype');

        $this->table->add_row($json->{'file_name'}, $json->{'file_size'},$json->{'file_ext'});
        echo $this->table->generate();
    }

This is the code I have on a page. It posts to the DB table 'file', which is optional, and then echoes back a table with the information. The forum is truncating an <img> tag, but you should be able to add this accordingly. Now just change your $.post() url to site_url('controller/uploadify'), and make sure you have a div with an id of #target on the page. You should have the table loaded back into the DOM.
#95

[eluser]Unknown[/eluser]
Ok, I the uploadify for CI posted by pickupman from here: http://www.reloadedpc.com/code-igniter/j...deigniter/, and after I copy files to my CI directory, i tried the demo (http://mycipath.com/index.php/upload), and i get sevral errors:

Code:
A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: upload/uploadify.php

Line Number: 2
Line numbers ar 2 to 5.

I suppose the problem is with json (i am using clean CI installation) Can you help me? What is wrong?

Thanks!
TMK
#96

[eluser]cdevroe[/eluser]
[quote author="M_K" date="1238233884"]Hi mate,

Open up uploader.fla and go to line 345 - change to:

Code:
var scriptURL:URLRequest = new URLRequest('upload.php' + '?folder=' + unescape(getFolderPath()) + unescape(param.scriptData));

You'll need to compile this version of the fla file over the existing swf and make sure the upload.php file lives in the same directory as the swf file.
[/quote]

I am having the IO Error issue when someone tries to include my uploading project using an iFrame on their site. Do you think that these fixes will resolve that issue? If so, would someone mind putting the SWF file somewhere to download? I do not have Flash installed and can not edit this file.

If not, perhaps there is another issue that I can adjust?
#97

[eluser]stalkerok[/eluser]
This code works:
Code:
if (!empty($_FILES)) {

            $tempFile = $_FILES['Filedata']['tmp_name'];
            $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
            $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];

            move_uploaded_file($tempFile,$targetFile);
            echo 1;
        }


Why not work:
Code:
if (!empty($_FILES)) {

            $config['upload_path'] = '..'.$_POST['folder'];
            $config['allowed_types'] = 'tmp,html';
            $config['max_size'] = '1000000';
            $this->load->library('upload', $config);

            if (!$this->upload->do_upload()) {
                $error = $this->upload->display_errors();
                $json_array = $this->json->json_encode($error);
                echo $json_array;
                return;
            }
            else {
                $data = $this->upload->data();
                $json_array = $this->json->json_encode($data);
                echo $json_array;
                return;
            }
            echo 1;
        }
#98

[eluser]stalkerok[/eluser]
output error: "You did not select a file to upload." why???
#99

[eluser]pickupman[/eluser]
You should use a piped delimiter in line
Code:
$config['allowed_types'] = 'tmp,html';

Should be:
Code:
$config['allowed_types'] = 'tmp|html';

[eluser]ilovecodes[/eluser]
Hi, I am new to CI and uploadify. My current project structure looks like this

myproject
codeigniter
css
images
js
system
uploads // This is where I want the files uploaded
index.php

and this is the javascript and base_url is pointing to the codeigniter folder
Code:
$(document).ready(function()
    {
        $('#uploadify').uploadify(
        {
            'uploader': '&lt;?php echo base_url();?&gt;js/lib/jquery.uploadify-v2.1.0/uploadify.swf',
            'script': '&lt;?php echo base_url();?&gt;js/lib/jquery.uploadify-v2.1.0/uploadify.php',
            'folder': '&lt;?php echo base_url();?&gt;uploads',
            'cancelImg': '&lt;?php echo base_url();?&gt;js/lib/jquery.uploadify-v2.1.0/cancel.png',            
            'wmode': 'transparent',
            'hideButton': true,
            'height': 24,
            'width': 200
        });
    });

but for some reason the absolute path does not work. Relative path is working though.




Theme © iAndrew 2016 - Forum software by © MyBB