uploadify not uploading in switch / if - else statement
<p>I've been using Uploadify plugin to upload files.
Basically, I need to upload different type of documents (photo, floorplan, brochure)</p>

<p>so, below is my uploadify code (the upload form)</p>

<pre><code>&lt;? $sid = session_id();  ?&gt;

$(document).ready(function() {
    $('#file_upload').uploadify({
        'uploader'  : 'js/uploadify214/uploadify.swf',
        'script'    : 'uploader.php?pid=&lt;? echo $pid; ?&gt;&amp;type=&lt;? echo $type; ?&gt;',
        'scriptData': {'session': '&lt;? echo $sid; ?&gt;'},
        'multi': true, // enable multiple upload
        'queueSizeLimit': 5, // number of file at once
        'onQueueFull': function(event, queueSizeLimit) {
            alert("You can only upload " + queueSizeLimit + " files at once");
            return false;
        },
        'cancelImg' : 'js/uploadify214/cancel.png',
        'auto'      : false,
        'onAllComplete' : function(event,data) {
              window.location = "files.php?pid=&lt;? echo $pid; ?&gt;" // redirect to previous page
        }
    });
});
</code></pre>

<p>All the upload will be handled by <strong>uploader.php</strong>
and below is the code</p>

<pre><code>session_id($_REQUEST['session']);
require_once('function.php');

$pid = $_REQUEST['pid'];
$type = $_REQUEST['type'];
$photo_file = $_FILES['Filedata'];
$photo_tags = 'test';
$status = '1';
$inuse = 0;

// the function will run if i put it here
property_photo_upload($user_id, $pid, $photo_file, $photo_tags, $inuse, 'photo');

// but if i put it in switch / if-else statement, the code will not run
switch($type){
    case 'photo' :
        property_photo_upload($user_id, $pid, $photo_file, $photo_tags, $inuse, 'photo');
        break;

    case 'floorplan' :
        property_doc_upload($user_id, $pid, $photo_file, $photo_tags, $inuse, 'floorplan');
        break;

    case 'brochure' :
        property_doc_upload($user_id, $pid, $photo_file, $photo_tags, $inuse, 'brochure');
        break;
}
</code></pre>

<p>So, the problem is if i put the upload function OUTSIDE / WITHOUT the switch / if-else statement, the upload progress can run without any problem.
But when i put the function within switch / if-else statement, suddenly the upload is not working.</p>

<p>I need the switch statement so that my code can handle the upload for different file type.</p>

<p>Any help is very appreciated.
sorry for my bad english and long question.
Thanks in advance</p>
