See Post # 331 by wainguo
See Post # 331 by wainguo
Can i show images uploaded on update?
Hi There!!
Thank You for great extension Asgaroth. I managed to upload files to the server with additional data. I added radio button to indicate default image(main image) shown in list view. All works great except one situation. After I add few images, I choose one main image via radio button, and start upload - I have expected result. But if before submitting the form I’will add again additional files I have another radio button, and can choose second main image. And this is the problem. I’d like to somehow remeber in my form that there is only one possible radio button to choose, and in case someone add files few times, will not be able to mark radio button if already marked. Or just block add files button after files are uploaded.
I belive this can be easily solve by JS but I don’t have enough skills
If anyone could help will be great
Thanks in advance
Regards
lukBB
Hi
I need help. I’m using
$secureFileNames = true;
After uploading file I want to sent to DB new genereted name and give it ID, proper description and url directly to file. Where should I start? I really need some guidance
Hey guys, im having a hard time with the CSRF Validation.
Every time I submit de upload’s im getting Invalid CSRF Token.
Any ideas?
Still no idea, I just need info what should I do.
Could any one tell me what is composer, and do we have to use it?
Since Yii has already provided a autoload feature. what’s the point of using this one?
Sorry for asking that, i am a newbie and really ignorance.
Hi, im new to Yii and this extension and i’ve got the following problem: Is there a way to loop through all the files a user has uploaded (this is what i want to do in the controller) ? I need to store the filepath and the user_id manually in a db.
My Controller:
public function actions()
{
return array('upload2' => array(
'class' => 'xupload.actions.XUploadAction',
'path' => Yii::app() -> getBasePath() . "/../data/uploads",
"publicPath" => Yii::app()->getBaseUrl()."/data/uploads" ),
);
}
...
public function actionUpload()
{
Yii::import("xupload.models.XUploadForm");
$model = new XUploadForm;
$model->file = CUploadedFile::getInstance( $model, 'file' );
$this->render('upload', array('model' => $model, ));
}
My view (upload.php)
$this->widget('xupload.XUpload', array(
'url' => Yii::app()->createUrl("check/upload2", array("parent_id" => 1)),
'model' => $model,
'attribute' => 'file',
'multiple' => true,
));
Thanks for advice
Tobias
__ Problem solved __
Hello,
I’m having an odd issue with xupload applying tooltips to a dateRangeRow which breaks the date selection. The dateRangeRow appears to use the “title” attribute for finding the value but with the tooltip, the “title” gets wiped out. Here’s an example (from Chrome) of a date option where I disable the xupload widget and when I have it enabled.
Disabled (so the dateRangeRow works) : <td class="available in-range" title="r3c2">17</td>
Enabled (broken) : <td class="available in-range" title aria-describedby="ui-tooltip-140">17</td>
I’ve gone through disabling different js and css files but I’m still not having any luck. The only way I can have the dateRangeRow work properly is to completely comment out the inclusion of the xupload widget (which is obviously not the ideal solution).
Any ideas?
Note – I switched from yiibooster to yiistrap/yiiwheels and it seems to all work well now.
[font=“Arial”]Hi Asgaroth I’m new to yii and I am having problem transferring the files addImage method in SomeModel model the first loop is not being uploaded it remain being in tmp folder but the other images had been uploaded… please help…thnx[/font]
Hi Asgaroth,
I am trying to use Xupload but I got this error: SyntaxError: JSON.parse: unexpected character.
What should I check?
Regards,
Agus Kianto
hola, necesito utilizar la librería mostrando una primera foto (pre-cargada), y que al hacer clic sobre en delete elimine la foto y permita cargar otra (funcionamiento normal de la librería), el problema es que no entiendo como pasar el parámetro para que muestre una imagen pre-cargada(ruta en BBDD) ya con el botón delete, antes de cargar una primera.
Gracias de antemano por su ayuda!!!!
Hi,
How can I preload (in Xupload) an image from database previosly uploaded with Xupload.
I’m doing what is explained here: http://www.yiiframework.com/wiki/348/xupload-workflow/
I have a model (ex. Person model ) with an image attribute.
Step 1: create a new Person, so I call person/create action and render the create form.
Step 2: fill the Person fields and load an Image using the Xupload extension.
Step 3: Save it in database.
Step 4: edit my previosly created model Post, so I call person/update and render the update form.
What I need is to display the image associated to this model, so I can edit it using the Xupload extension.
Have you any idea how can I do this?
Thanks in advance.
Carlos
Hi,
it works for me, thank you. I have another question:
I set ‘multiple’ => false. This way when I preload my image I need to Disable the button to avoid looking for other pictures. And enable it when I delete the current picture.
I think I have to write something else in the previous code:
<script type="text/javascript">
$(function () {
'use strict';
// Initialize the jQuery File Upload widget:
$('#XUploadForm-form').fileupload({
url: 'getphotos/'
});
$.ajax({
url: $('#XUploadForm-form').fileupload('option', 'url'),
dataType: 'json',
context: $('#XUploadForm-form')[0]
}).done(function (result) {
$(this).fileupload('option', 'done')
.call(this, null, {result: result});
// HAVE TO WRITE SOMETHING ELSE HERE, BUT I DON'T KNOW WHAT !!!!!!!!!!!!!
});
});
</script>
Thanks in adavance.
Hi guys
Got a question about this awesome plugin. How to execute some javascript after ALL files are uploaded?
Example: you’re uploading 7 files -> on submit you add some waiter, when ALL files are loaded you hide waiter.
Any ideas?
Best.
i’ll reload page, by F5 button, all generated images preview, disappear.
I want display their again, after page refresh.
i’ try this code but not working
<script type="text/javascript">
$(function () {
'use strict';
// Initialize the jQuery File Upload widget:
$('#XUploadForm-form').fileupload({
url: 'getphotos/'
});
$.ajax({
url: $('#XUploadForm-form').fileupload('option', 'url'),
dataType: 'json',
context: $('#XUploadForm-form')[0]
}).done(function (result) {
$(this).fileupload('option', 'done')
.call(this, null, {result: result});
});
});
</script>
What to do in this case?
Hi,
Is there a way to redirect the browser after all selected files are being uploaded ?
Thanks
Or is it possible to display a message when the upload is done ?
I think you should do any action with ajax (url is upload action I guess), so with upload action you should send array to view and then render it. Still - it should work only with single file. To multiple files, got the same question
I want to use the extension xupload. but i have a problem when uploading files
my controller IdentityController.php
public function actions() {
return array('upload' => array(
'class' => 'xupload.actions.XUploadAction',
'path' => Yii::app()-> getBasePath(). "/../images/uploads",
"publicPath" => Yii::app()->getBaseUrl()."/images/uploads" ),
);
}
public function actionCreate()
{
$model= new Identity;
$model2 = new XUploadForm;
if(isset($_POST['Identity']))
{
$model->attributes=$_POST['Identity'];
if($model->save())
$this->redirect(array('index'));
}
$this->render('create',array(
'model'=>$model,'model2'=>$model2
));
}
assume in create.php, i have added attribute $model2 (from controller)
my view _form.php
<?php
$this->widget('xupload.XUpload', array(
'url' => Yii::app()->createUrl("identity/upload"),
'model' => $model2,
'name'=>'filenpwp',
'multiple' => true,
));
?>