I need to move all uploaded files in domain , and all website will be in another domain
but in same server ip , so how to edit uploading process to upload files directly to " Files domain " ? .
EX:
Site Domain : doamin.com
Files domain : myfiles.com
in normal way this my code :
View
.
..........
<?php
$form=$this->beginWidget('CActiveForm', array(
'id'=>'Cfiles-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
'clientOptions'=>array('validateOnSubmit'=>true), //This is very important
'htmlOptions' => array('enctype' => 'multipart/form-data'),
)); ?>
<div class="row">
<?php echo $form->labelEx($model,'file'); ?>
<?php echo $form->fileField($model,'file'); ?>
الملفات المسموحة : jpg,gif, png,pdf,rar,zip,doc,docx
<?php echo $form->error($model,'file'); ?>
</div>
...............
Controller
public function actionCreate()
{
..................
.
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if(isset($_POST['Cfiles']))
{
$model->attributes=$_POST['Cfiles'];
$valdiate=$model->validate();
/////// upload image functions
$rnd = rand(0,999984375); // generate random number between 0-9999
$model->attributes=$_POST['Cfiles']['file'];
$uploadedFile=CUploadedFile::getInstance($model,'file');
if(!empty($uploadedFile)){
$ext=$uploadedFile->getExtensionName();
$fileName = "isa$rnd.{$ext}"; // random number + file name
}
////////// end
Thanks in advance