eajaxupload Failed Upload


(Abedi98) #1

hi

i want to use this extention >> http://www.yiiframework.com/extension/eajaxupload

and use to my module but when selected file , failed 1.jpg 69.5kB Failed

create.php in Post View


<div class="form">

<?php $form=$this->beginWidget('CActiveForm'); ?>

 

    <?php //echo $form->errorSummary($model); ?>

 

    <div class="row">

        <?php echo $form->label($model,'title'); ?>

        <?php echo $form->textField($model,'title') ?>

    </div>

	

	<?php $this->widget('ext.EAjaxUpload.EAjaxUpload',

array(

        'id'=>'uploadFile',

        'config'=>array(

               'action'=>'/post/upload',

               'allowedExtensions'=>array("jpg"),//array("jpg","jpeg","gif","exe","mov" and etc...

               'sizeLimit'=>10*1024*1024,// maximum file size in bytes

               // minimum file size in bytes

               //'onComplete'=>"js:function(id, fileName, responseJSON){ alert(fileName); }",

               //'messages'=>array(

               //                  'typeError'=>"{file} has invalid extension. Only {extensions} are allowed.",

               //                  'sizeError'=>"{file} is too large, maximum file size is {sizeLimit}.",

               //                  'minSizeError'=>"{file} is too small, minimum file size is {minSizeLimit}.",

               //                  'emptyError'=>"{file} is empty, please select files again without it.",

               //                  'onLeave'=>"The files are being uploaded, if you leave now the upload will be cancelled."

               //                 ),

               //'showMessage'=>"js:function(message){ alert(message); }"

              )

)); ?>

    

 

<?php $this->endWidget(); ?>

</div>

actionUpload in post Model Class


public function actionUpload()

{

	Yii::import("ext.EAjaxUpload.qqFileUploader");

 

        $folder='upload/';// folder for uploaded files

        $allowedExtensions = array("jpg");//array("jpg","jpeg","gif","exe","mov" and etc...

        $sizeLimit = 10 * 1024 * 1024;// maximum file size in bytes

        $uploader = new qqFileUploader($allowedExtensions, $sizeLimit);

        $result = $uploader->handleUpload($folder);

        $result=htmlspecialchars(json_encode($result), ENT_NOQUOTES);

        echo $result;// it's array

}


(Abedi98) #2

ehe uheee, nobody !?


(Abedi98) #3

ALOOOOOOOOO PLEASEEEEEEEEEEEEEEEE


(Forums) #4

I got the same error when I tried that extension.


(Forums) #5

I’ve found a way round it… you need to increase the file upload limits.

Either put the following in your php.ini file:

[font="Courier New"]post_max_size = 10M

upload_max_filesize = 10M[/font]

or the following in your .htaccess file:

[font="Courier New"]php_value upload_max_filesize 10M

php_value post_max_size 10M[/font]


(Papagel75) #6

I experience a similar problem.

It is not due to php settings since I can see the file uploaded successfully.

Still, the script returns a Failed status.

I will conduct a more tests on the actual extension to find the core of the problem.


(Maupv99) #7

I found out that it has a conflict with Yii´s CSRF Validation. Solved that problem allowing CSRF token to be submitted by GET (http://www.yiiframework.com/forum/index.php?/topic/14500-re-writing-a-class-method-without-editing-framework-files/)


(Cpierce42) #8

if your running on a linnux server create a file called .user.ini (talk to your server admin first!) and set the max post size and max upload file size properties as though you were editing php.ini

This helped me a lot but for some strange reason the callback is still broken, the file uploads but the little tool tip display says "failed".


(rajesh chaurasia) #9

when i upload an image it give an error message increase post max size and upload max size 10m i not understand how to fixed it problem.


(Jonauz) #10

Hi,

I’m new in Yii, straggling with EAjaxUpload extension. I keep getting “[color=”#FF0000"]image.png 1.2kB Failed[/color]" on upload.

In console it shows:

[color="#FF0000"]POST[/color] http ://localhost/testdrive/index.php?r=controller/upload&PHPSESSID=&YII_CSRF_TOKEN=64cdd116e7f456ce0257dc5b86d55da437e74cd5&qqfile=image.png [color="#FF0000"]404 (Not Found)[/color] fileuploader.js:1204

[color="#FF0000"]qq.extend._upload[/color] fileuploader.js:1204

[color="#FF0000"]qq.UploadHandlerAbstract.upload[/color] fileuploader.js:892

[color="#FF0000"]qq.FileUploaderBasic._uploadFile[/color] fileuploader.js:397

[color="#FF0000"]qq.FileUploaderBasic._uploadFileList[/color] fileuploader.js:388

[color="#FF0000"]qq.FileUploaderBasic._onInputChange[/color] fileuploader.js:372

[color="#FF0000"]qq.UploadButton.onChange[/color] fileuploader.js:309

[color="#FF0000"](anonymous function)[/color] fileuploader.js:825

Checked all max files sizes allowed many times, seems fine, php.ini has 32MB allowed.

My "uploads" directory is in "WebRoot/testdrive/uploads/" with


$folder=Yii::app()->request->baseUrl.'/uploads/';

I’m using simplest steps as a base from here:

http ://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app

And adding functionality to send an image to server with this tool and simplest way it is written there:

http ://www.yiiframework.com/extension/eajaxupload/

Can’t make it work, I would appreciate any help.

Thanks


(It) #11

hi,

it doesn’t matter if you set post_max_size and upload_max_size into php.ini unless values ARE IDENTICAL with the ones from this extensions.


(Arturo) #12

hi!!

how you resolved your problem, i have the same

POST http ://localhost/testdrive/index.php?r=controller/upload&PHPSESSID=&YII_CSRF_TOKEN=…=image.png 404 (Not Found) fileuploader.js:1205

please send your answer to: arturo@jovenclub.cu


(Arturo) #13

hi!!

how you resolved your problem, i have the same

POST http ://localhost/testdrive/index.php?r=controller/upload&PHPSESSID=&YII_CSRF_TOKEN=…=image.png 404 (Not Found) fileuploader.js:1205

please send your answer to: arturo@jovenclub.cu


(Mark) #14

hi,

i tried uploading 1200 files in one batch, and it doesnt seem to work(nothing happens), but no errors are given.

so far, i have tried 133 files in one Go, with no problem.

any idea what causes this?


(Mark) #15

Anyway, sorry for not being able to provide a solution for the problem in this topic, i had the same problem before, and i got the extension to work, but i forgot what i exactly did to fix it.

will try to figure it out and give you feedback, as soon as i can.