EAjaxUpload Extension Issues with operation
#1
Posted 07 March 2011 - 01:34 AM
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.
#2
Posted 07 March 2011 - 01:57 AM
#3
Posted 07 March 2011 - 10:40 PM
kosenka, on 07 March 2011 - 01:57 AM, said:
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
#4
Posted 09 March 2011 - 06:07 AM
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
#5
Posted 09 March 2011 - 06:18 AM
Micheal, on 09 March 2011 - 06:07 AM, said:
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?
#6
Posted 09 March 2011 - 06:47 AM
[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
#7
Posted 09 March 2011 - 06:57 AM
Micheal, on 09 March 2011 - 06:47 AM, said:
[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.
#8
Posted 09 March 2011 - 08:26 AM
kosenka, on 09 March 2011 - 06:57 AM, said:
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?
#10
Posted 09 March 2011 - 04:30 PM
kosenka, on 09 March 2011 - 08:41 AM, said:
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.
#11
Posted 17 March 2011 - 03:21 PM
kosenka, on 09 March 2011 - 06:18 AM, said:
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
#12
Posted 14 April 2011 - 01:03 AM
kosenka, on 07 March 2011 - 01:57 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
#13
Posted 02 June 2011 - 12:09 PM
nadeem, on 14 April 2011 - 01:03 AM, said:
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?
#14
Posted 02 June 2011 - 01:17 PM
You must self to write code to save the file name in the database.
#16
Posted 02 June 2011 - 02:33 PM
#17
Posted 04 June 2011 - 06:43 PM
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.
#18
Posted 21 June 2011 - 02:59 AM
'onComplete'=>"js:function(id, fileName, responseJSON){ alert(responseJSON); }",
but the result is [object Object]
thanks.
#19
Posted 22 July 2011 - 02:55 AM
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!
#20
Posted 31 July 2011 - 01:46 PM
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

Help













