Yii Framework Forum: EAjaxUpload Extension - Yii Framework Forum

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

EAjaxUpload Extension Issues with operation Rate Topic: -----

#1 User is offline   Micheal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 07-March 11

Posted 07 March 2011 - 01:34 AM

I have installed the EAjaxUpload Extension. Could not find any entries using search - so a new topic. Was not able to post against the entry in Extensions.

The page prompts for a file, it downloads with progress but at the end it just says "Failed."
I have tried placing "upload" folders everywhere in case I created in the wrong directory. I cannot much information on this extension, but I would like to use this as it seems to be the most compact.

Any help would be appreciated.
0

#2 User is offline   kosenka 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 05-October 09

Posted 07 March 2011 - 01:57 AM

Hello. I'm the author of this extension. Please describe as fully as possible what you have a problem?
0

#3 User is offline   Micheal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 07-March 11

Posted 07 March 2011 - 10:40 PM

View Postkosenka, on 07 March 2011 - 01:57 AM, said:

Hello. I'm the author of this extension. Please describe as fully as possible what you have a problem?



Hi, thanks for the assistance. I have a simple site that I requires an upload feature. I have loaded the extension as instructed. The upload button appears on the view and I can select a file. It goes though the process of uploading and then it lists the file with a "Failed." response. I have not been able to debug as the transaction happens outside of YIi/PHP and is between the OS and the Browser.

I have tried to add "upload" directory in a number of spots but cannot find any instruction as to where exactly to locate. The other question is where is the temporary file saved? Does another directory need to be created with write permissions?

Thanks again.
Micheal
0

#4 User is offline   Micheal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 07-March 11

Posted 09 March 2011 - 06:07 AM

Kosenka,

Further to the above. I had a look at the 'valums.com/ajax-upload' site to see what I could find.
I was able to trace down to the following;

'action'=>'/controller/upload'

I am changing the word controller to '/accreditation/upload'; as I had added the actionUpload() to my AccreditationController.php.

The error is that I get a 404 error 'upload'; not found.

I hope that is enough information for you to point me in the right direction. It's very close now.

I would also like to know where to place the default folder 'uploads'.

Thanks again.
Micheal
0

#5 User is offline   kosenka 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 05-October 09

Posted 09 March 2011 - 06:18 AM

View PostMicheal, on 09 March 2011 - 06:07 AM, said:

I am changing the word controller to '/accreditation/upload'; as I had added the actionUpload() to my AccreditationController.php.
The error is that I get a 404 error 'upload'; not found


Try to open in the browser: http://[you'r_site]/accreditation/upload
Will there be any errors?
0

#6 User is offline   Micheal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 07-March 11

Posted 09 March 2011 - 06:47 AM

I had to include the folder and index.php (/narta/index.php/accreditation/upload) and got the following;
[uploader] responseText = {'error':'increase post_max_size and upload_max_filesize to 10M'}

Here are my configuration files;

{view}.php

<?php $this->widget('ext.EAjaxUpload.EAjaxUpload',
				                 array(
				                       'id'=>'uploadFile',
				                       'config'=>array(
				                                       'action'=>'/narta/index.php/accreditation/upload',
				                                       'allowedExtensions'=>array("jpg","jpeg","gif","pdf","png"), //and etc...
				                                       'sizeLimit'=>10*1024*1024,// maximum file size in bytes
				                                       'minSizeLimit'=>1,// 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); }"
				                                      )
				                      ));
			?>


AccreditationController.php

	public function actionUpload()
	{
		        Yii::import("ext.EAjaxUpload.qqFileUploader");

	                $folder='upload/';// folder for uploaded files
	                $allowedExtensions = array("jpg","jpeg","gif","png","pdf"); // 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
	}


The test file is 'logo.png 0.9kB'

Thanks in advance.
Micheal
0

#7 User is offline   kosenka 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 05-October 09

Posted 09 March 2011 - 06:57 AM

View PostMicheal, on 09 March 2011 - 06:47 AM, said:

I had to include the folder and index.php (/narta/index.php/accreditation/upload) and got the following;
[uploader] responseText = {'error':'increase post_max_size and upload_max_filesize to 10M'}


This message: "[uploader] responseText = {'error': 'increase post_max_size and upload_max_filesize to 10M'}" indicates that your server are restrictions on the size of an uploaded file.
Look in the php.ini: post_max_size, upload_max_filesize

Try to reduce the value of "sizeLimit" in EAjaxUpload.
0

#8 User is offline   Micheal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 07-March 11

Posted 09 March 2011 - 08:26 AM

View Postkosenka, on 09 March 2011 - 06:57 AM, said:

This message: "[uploader] responseText = {'error': 'increase post_max_size and upload_max_filesize to 10M'}" indicates that your server are restrictions on the size of an uploaded file.
Look in the php.ini: post_max_size, upload_max_filesize

Try to reduce the value of "sizeLimit" in EAjaxUpload.



OK I changed to 3MB and the error is;

increase post_max_size and upload_max_filesize to 3M

Any ideas?
0

#9 User is offline   kosenka 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 05-October 09

Posted 09 March 2011 - 08:41 AM

View PostMicheal, on 09 March 2011 - 08:26 AM, said:

OK I changed to 3MB and the error is;

increase post_max_size and upload_max_filesize to 3M

Any ideas?


Try to reduce to 1 MB and show me what settings are in php.ini in : "post_max_size" and "upload_max_filesize".
0

#10 User is offline   Micheal 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 07-March 11

Posted 09 March 2011 - 04:30 PM

View Postkosenka, on 09 March 2011 - 08:41 AM, said:

Try to reduce to 1 MB and show me what settings are in php.ini in : "post_max_size" and "upload_max_filesize".


This is the problem. I changed to 1M and the file uploaded. Now it looks like I need to find my php.ini file on my VPS so I can upload larger files.
Thank you for you assistance.
0

#11 User is offline   blackjack 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 19-February 11

Posted 17 March 2011 - 03:21 PM

View Postkosenka, on 09 March 2011 - 06:18 AM, said:

Try to open in the browser: http://[you'r_site]/xxxx/upload
Will there be any errors?


Hi,
have also tried to get the extension run but i failed too.

Have got an http-error 403 if i call http://[you'r_site]/event/upload.

1) Have added your code snipplet for the view
2) Have added your code snipplet for the controller to EventController.php
- Removed the litte type (, -> ; on line 6)
3) Called http://[you'r_site]/event/upload and got 403 error.

Could you tell me where to create the 'upload'-folder?

Have tried it with ../view/event/upload and set the permissions to 777 but that doesn't work.

Could you please help.

THANKS
BJ
0

#12 User is offline   nadeem 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 17-March 11
  • Location:india

Posted 14 April 2011 - 01:03 AM

View Postkosenka, on 07 March 2011 - 01:57 AM, said:

Hello. I'm the author of this extension. Please describe as fully as possible what you have a problem?



hello

i am newbie in yiiframework i installed your extension its working fine and thanks for the gr8 extension but

i have one issue i wanted to store all the file name in to database so not understand how to get all the file names and store it while submitting the form

if you could help me out i will be very thankful

as soon as possible give me reply its urgent
0

#13 User is offline   Vedran 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 02-June 11
  • Location:Sarajevo

  Posted 02 June 2011 - 12:09 PM

View Postnadeem, on 14 April 2011 - 01:03 AM, said:

hello

i am newbie in yiiframework i installed your extension its working fine and thanks for the gr8 extension but

i have one issue i wanted to store all the file name in to database so not understand how to get all the file names and store it while submitting the form

if you could help me out i will be very thankful

as soon as possible give me reply its urgent


Hello everyone,
First of all, thanks for this extension, good job.

I have the same problem as @nadeem. In my case, image uploader should be part of form with many fields.


So I changed:

echo $form->textField($model,'banner',array('size'=>50,'maxlength'=>128)); 


into:

$this->widget('ext.EAjaxUpload.EAjaxUpload',
		array(
				'id'=>'uploadFile',
				'config'=>array(
					   'action'=>Yii::app()->baseUrl.'/content/upload',
					   	'allowedExtensions'=>array("jpg"),//array("jpg","jpeg","gif","exe","mov" and etc...
						'sizeLimit'=>10 * 1024 * 1024,// maximum file size in bytes
						'minSizeLimit'=>1*1024,// 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); }"
					  )
		));


This extension successfully upload image but does not enter the name of file in db. In other extensions(that I use in same form for other purposes), I simply include properities of this field:

 "model"=>$model,                 # Data-Model
 "attribute"=>'banner',           # Attribute in the Data-Model


and after pressing a button Save, script saves information in corresponding field in db.

But here I haven't that option. How I could solve this? :unsure: :blink:
0

#14 User is offline   kosenka 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 05-October 09

Posted 02 June 2011 - 01:17 PM

EAjaxUpload does not work with the database.
You must self to write code to save the file name in the database.
0

#15 User is offline   Vedran 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 02-June 11
  • Location:Sarajevo

Posted 02 June 2011 - 02:09 PM

View Postkosenka, on 02 June 2011 - 01:17 PM, said:

EAjaxUpload does not work with the database.
You must self to write code to save the file name in the database.


Aha, ok.
Is there any way I can get file name out of this widget in view file? Then I could pass that name as a value to db. =)
0

#16 User is offline   kosenka 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 05-October 09

Posted 02 June 2011 - 02:33 PM

The widget transfers the file name to the controller. Look at the example of the controller here http://www.yiiframew...on/eajaxupload/
0

#17 User is offline   Vedran 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 02-June 11
  • Location:Sarajevo

Posted 04 June 2011 - 06:43 PM

Thanks for answer. I did not manage to find that place of code where I can pull out name of image file to db. Never mind. Thank you anyway.

I gave up from this extension and implemented this solution for image uploading.

Now I have some other problems with this suggestion, but that is a story for another post. :D
0

#18 User is offline   Sonny Lazuardi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 01-May 11

Posted 21 June 2011 - 02:59 AM

how to see the json response? i use this

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

but the result is [object Object]
thanks.
0

#19 User is offline   neverabe 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 21-March 11

Posted 22 July 2011 - 02:55 AM

I try to use this extension but i only get "failed" when i upload an image
here is my code

UploadController.php

class UploadController extends Controller
{
	public function actionIndex()
	{
		$this->render('index');
	}
        
	public function actionUpload()
	{

		Yii::import("ext.EAjaxUpload.qqFileUploader");
	 
		$folder=Yii::app()->baseUrl.'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
	}


}



site/index.php

	<? $this->widget('ext.EAjaxUpload.EAjaxUpload',
	array(
        'id'=>'uploadFile',
        'config'=>array(
               'action'=>Yii::app()->baseUrl.'UploadController',
               'allowedExtensions'=>array("jpg"),//array("jpg","jpeg","gif","exe","mov" and etc...
               'sizeLimit'=>10*1024*1024,// maximum file size in bytes
               'minSizeLimit'=>1*1*1024,// minimum file size in bytes
		//'folder'=>'../../images/',
               //'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); }"
              ),
	)); ?>


I need some help here please! :-[
0

#20 User is offline   Zephyr 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 31-July 11

Posted 31 July 2011 - 01:46 PM

I alsoo had some issues with this extension, and was about to give up, but finally managed to get it working, here are my steps, for those who need help:

1) Make sure your upload folder exists and has the right chmod properties (set it on 777 first, and if you got it working set it on 775). the upload folder should be in the root of the site.

2) I had issues with "file not found controller/upload/". My Yii app was in a subfolder for testing. Once I put it in the root (in my case I put it in a subdomain folder). It worked. This could be a pathing issue from my side. but it worked.

3) Adjust the php.ini with:
upload_max_filesize = 10M
post_max_size = 10M

if you dont have a php.ini. Create one and put it in the root of your site (or wherever your hostingprovider wants it).

This is my code:
the view (index.php in my case)
<? $this->widget('ext.EAjaxUpload.EAjaxUpload',
array(
        'id'=>'uploadFile',
        'config'=>array(
               'action'=>'/Builder/CreateThumb',
               'allowedExtensions'=>array("jpg"),//array("jpg","jpeg","gif","exe","mov" and etc...
               'sizeLimit'=>10*1024*1024,// maximum file size in bytes
               'minSizeLimit'=>1024,// minimum file size in bytes
               'onComplete'=>"js:function(id, fileName, responseJSON){ console.log(responseJSON); }",
               '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); }"
              )
)); ?>


the controller (in my case BuilderController)
<?php
class BuilderController extends Controller
{
    public function actionCreateThumb(){
        
         Yii::import("ext.EAjaxUpload.qqFileUploader");

        $folder='var/projects/';// 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
    }
}


regardds,
Zephyr
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users