Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload