Welcome Guest, Not a member yet? Register   Sign In
SWF Upload + CodeIgniter
#1

[eluser]E-Finity Internet[/eluser]
Hello,

I'm using a swf uploader (also uploadify) in my project.

When I upload.php in the root of my server site and use the images successfully uploaded.

When I change the URL to a URL within CodeIgninter, then the script is not executed.

for example:
Code:
/ Public_html / upload.php
works

Code:
/ Public_html / application / controllers / album.php
does not work.

The line I use for calling the URL:

DOES NOT WORK
Code:
window.onload = function () (
swfu = new SWFUpload ((
/ / Backend Settings
upload_url "<? = base_url ();?>/ albums / uploads"

WORKS
Code:
window.onload = function () (
swfu = new SWFUpload ((
/ / Backend Settings
upload_url "<? = base_url ();?>/ upload.php"

Apart from the fact that an upload is placed or not, it seems that the URL never arrives.

Part of the controller:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Albums extends Controller
{
    
    function __construct()
    {
        parent::__construct();
    }

        
    function upload()
    {    
        
        $config['upload_path'] = $_SERVER['DOCUMENT_ROOT'].'/uploads/';
        $config['allowed_types'] = 'jpg';
        $config['max_size']    = '10240';

        $this->load->library('upload', $config) // load the upload class

        if ( ! $this->upload->do_upload("Filedata"))
        {
            $this->HandleError("File is not uploaded");
        } else {
            $file_id = md5($_FILES["Filedata"]["tmp_name"] + rand()*100000);
            $_SESSION["file_info"][$file_id] = $imagevariable;
            echo "FILEID:" . $file_id;    // Return the file id to the script
        }

Even the HandleError wil never arrives. Can sombody help me?
#2

[eluser]Georgi Budinov[/eluser]
Is this a typo - looking at the end .. you have 's', but in the controller the function is without 's' ?

Code:
upload_url "<? = base_url ();?>/ albums / uploads"
#3

[eluser]E-Finity Internet[/eluser]
Sorry, my mistake.

This is just one small example of my situation. The real script is slightly different names. 've Been checked to be sure, but here I have no errors for that.
#4

[eluser]Georgi Budinov[/eluser]
Ok I can advise you do some things:

- Check if you actually can access the url /albums/upload.
- Use FireBug, in the Net tab you can see the requests made by the swf .. so this way you can understand what is happening - also you can see the post data , response and other stuff
#5

[eluser]E-Finity Internet[/eluser]
Thanx, i will try.

The first point is possible. This wil give no errors.

The second i will look for.
#6

[eluser]danmontgomery[/eluser]
Have you tried enabling swfupload's debug feature?
#7

[eluser]E-Finity Internet[/eluser]
Yes, i tried.

The results:
Code:
---SWFUpload Instance Info---
Version: 2.2.0 2009-03-25
Movie Name: SWFUpload_0
Settings:
    upload_url:               *domain/fotoalbum/upload/20100722111744
    flash_url:                *domain/assets/swfupload/swfupload.swf?preventswfcaching=1279893299077
    use_query_string:         false
    requeue_on_error:         false
    http_success:            
    assume_success_timeout:   0
    file_post_name:           Filedata
    post_params:              [object Object]
    file_types:               *.jpg
    file_types_description:   JPG Images
    file_size_limit:          2 MB
    file_upload_limit:        0
    file_queue_limit:         0
    debug:                    true
    prevent_swf_caching:      true
    button_placeholder_id:    spanButtonPlaceholder
    button_placeholder:       Not Set
    button_image_url:         *domain/assets/images/SmallSpyGlassWithTransperancy_17x18.png
    button_width:             260
    button_height:            20
    button_text:              <span class="button">Selecteer (meerdere) afbeeldingen <span class="buttonSmall">(2 MB Max)</span></span>
    button_text_style:        .button { font-family: Helvetica, Arial, sans-serif; font-size: 12pt; } .buttonSmall { font-size: 10pt; }
    button_text_top_padding:  3
    button_text_left_padding: 18
    button_action:            -110
    button_disabled:          false
    custom_settings:          [object Object]
Event Handlers:
    swfupload_loaded_handler assigned:  false
    file_dialog_start_handler assigned: false
    file_queued_handler assigned:       false
    file_queue_error_handler assigned:  true
    upload_start_handler assigned:      false
    upload_progress_handler assigned:   true
    upload_error_handler assigned:      true
    upload_success_handler assigned:    true
    upload_complete_handler assigned:   true
    debug_handler assigned:             true

SWF DEBUG: SWFUpload Init Complete
SWF DEBUG:
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number:           SWFUPLOAD 2.2.0
SWF DEBUG: movieName:              SWFUpload_0
SWF DEBUG: Upload URL:             *domain/fotoalbum/upload/20100722111744
SWF DEBUG: File Types String:      *.jpg
SWF DEBUG: Parsed File Types:      jpg
SWF DEBUG: HTTP Success:           0
SWF DEBUG: File Types Description: JPG Images (*.jpg)
SWF DEBUG: File Size Limit:        2097152 bytes
SWF DEBUG: File Upload Limit:      0
SWF DEBUG: File Queue Limit:       0
SWF DEBUG: Post Params:
SWF DEBUG:                         PHPSESSID=e61182c1801736ba7304823c2b37cba7
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
SWF DEBUG: Event: fileDialogStart : Browsing files. Multi Select. Allowed file types: *.jpg
SWF DEBUG: Select Handler: Received the files selected from the dialog. Processing the file list...
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished processing selected files. Files selected: 1. Files Queued: 1
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: PHPSESSID=e61182c1801736ba7304823c2b37cba7
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload.  Starting upload to *domain/fotoalbum/upload/20100722111744 for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
#8

[eluser]Alleknalle[/eluser]
I've got the same problem.

Everything works great in IE, but in the other browsers it seems that it doesn't get to the URL at all.

Tried de debug mode (returns no data) and with firebug I don't get anything back either.

Does someone know how to fix this?

*******EDIT********
Found out what went wrong. It was a session problem. In my constructor I check if a user is logged in. If not, It does a redirect. Because of the session thing with flash it doesn't work, because I haven't got a session and because of the redirect I don't get an error message.




Theme © iAndrew 2016 - Forum software by © MyBB