EAjaxUpload Extension

Is there sample how to use EAjaxUpload with model/database?

Someone can help me to return the filename & filesize in the view plz, in order to save it into a database.

i don’t know how to return these values.

best regards.

Hi, inside the handleUpload function, i’ve renamed the file before save it. But inside onComplete,

‘onComplete’=>“js:function(id, fileName, responseJSON){ alert(fileName); }”,

the fileName displayed is the original one, not the changed one. How to retrieve the new filename assigned before saving? Thank you!

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

hi,

I am trying to implement this extension. I have successfully uploaded files using the demo application in framework’s guide. But in my original app I am getting “No files were uploaded” error. $_GET and $_FILES seem to be empty. I thought it is about using urlformat = ‘path’. To try that out I changed demo app’s setting to use ‘path’ and that worked. Is there any other idea what might cause this problem? I have also read some posts about CSRF token being invalid in GET requests but I don’t think that’s the reason

any help will be appreciated

Hi,

Is there a way to change the file name prior to uploading the image to the server ??

Or is the ambitious file name handled at some stage other than the OS handling ???

Regards,

Kaushik

I found the solution to this on the following link:

http://stackoverflow.com/questions/8543909/how-to-use-xupload-with-yii ( Find this in the answers)

This line allows you to rename the file which is being uploaded:

rename($folder.$result[‘filename’],$folder.“newfilename”);

Hi all :)

did someone found the way to pass filenames to DB?

Right now i’m sending them from a form but the problem is that i cannot concat them together. The last replace all the previous.

Maybe someone have a better idea to pass them to controller and then process them?

Thank you since now :)

Hey, did you ever get this fixed cause I am having the same problem :confused:

Let me know :)

thanks :)

I have good and bad news. To solve you problem you have to change string in you view:


'action'=>Yii::app()->createUrl('controller/upload'),

insted ‘controller’ paste name of controller wich you use.

Also if you get 403 you have to add actionUpload to validation rules:


public function accessRules()

	{

		return array(

			array('allow',  // allow all users to perform 'index' and 'view' actions

				'actions'=>array('index','view','upload'),

				'users'=>array('*'),

			),

............

Bad news - its still doesnt work…

Even i am having the same issue image uploading gets the failed message,still not able to correct error,please do reply if any one has the solution for this.Struggling from two days.

can this extension return file extension before submission? I have to create functionality that allow a specific webpage to upload audio/video or image file using this eajaxupload. Where audio/video and images are going to store at different place, have different allow extension (obviously) and different max file size allowed.

I have already functionality where only audio/video file upload is handled, and also separate functionality for image upload. But now I want a specific functionality to upload all 3 type of files from 1 location.

I was wondering if plugin can return file extension before or after file upload then maybe i can assign it already existing functions according to file type.

Please help.