Integrate Uploadify

Hello

I am intergrating uploadify with yii framework, Code is working fine until i am not changing uploadfy.php path. When i am changing ‘uploader’ path from ‘<?php echo Yii::app()->request->baseUrl; ?>/uploadify/uploadify.php’ to <?php echo Yii::app()->createAbsoluteUrl(‘Product/uploadimg’);?> then uploadify shows I/O Error.




<script type="text/javascript">

    $(document).ready(function() {


      $('#file_upload').uploadify({

        'swf'  : '<?php echo Yii::app()->request->baseUrl; ?>/uploadify/uploadify.swf',

//      'uploader'    : '<?php echo Yii::app()->request->baseUrl; ?>/uploadify/uploadify.php',

        'uploader'    : '<?php echo Yii::app()->createAbsoluteUrl('Product/uploadimg');?>',

        'auto'      : true,

	'method'   : 'post',

	'fileExt'     : '*.jpg;*.gif;*.png',

	'fileDesc'    : 'Web Image Files (.JPG, .GIF, .PNG)',

	'multi'		:true,

	'displayData' : 'speed',

        'onUploadSuccess' : function(file, data, response) {

         alert('The file was saved to: ' + data);

           },

        'onUploadError' : function(file, errorCode, errorMsg, errorString) {


         alert('The file ' + file.name + ' could not be uploaded: ' + errorString+' errorCode: '+errorCode+' errorMsg:+errorMsg);

    }         

	      });

    });


</script>

Can anyone help me to rectify this issue.

Thanks

  1. View source of the page

  2. See what is the result of <?php echo Yii::app()->createAbsoluteUrl(‘Product/uploadimg’);?>

  3. Make sure this url really exists (probably not)

  4. Modify the url to get rid of 404

  5. Profit.

Hello ORey

Thanks for your help but i am getting HTTP 302 error.

  1. Google for what 302 means (it’s redirect)

  2. Think about why you’re getting a redirect (probably access control issues)

  3. Open this url in browser tab and see what’s actually happening

  4. Fix that.

Srsly, it’s not so hard.