vivekcu
(Vivekcu 08)
1
i have the following code in the controller…
the upload function is working for every file except exe files…
can anyone tell me why???
if (isset($_POST[‘SoftwareVersion’])) {
$model->attributes = $_POST['SoftwareVersion'];
$model->updated_date = date("Y-m-d H:i:s");
$model->swid = $_GET['swid'];
$up_version = CUploadedFile::getInstance($model, 'upload_version');
$filename = $up_version->name;
$model->file_name = $filename;
if ($model->save())
{
$up_version->saveAs(Yii::app()->basePath . '/../softwares/' . $filename);
$this->redirect(array('vindex', 'swid' => $model->swid));
}
}
konapaz
(Konapaz)
2
Please post the model rules also (in addition post ‘before’ validate method if it is overridden)
Also what message error displayed?
Does your server allows you to upload ‘exe’ files ?
Keith
(Kburton)
3
Assuming it’s not a security feature (which it could be), are you sure your executable files aren’t simply too big?
vivekcu
(Vivekcu 08)
4
i am not getting any kinds of errors…
i am doing it in localhost…
if i upload a pdf or a zip file,it gets copied to the folder i want but the exe file doesn’t
i dont get any errors
vivekcu
(Vivekcu 08)
5
yes keith iam sure the files aren’t that big…
for testing i just tried it with an exe file of 1 mb…
but the file is not getting saved to the folder that i want
vivekcu
(Vivekcu 08)
6
so far i havent given any model rules…
konapaz
(Konapaz)
7
Hi again
Did you check it with native-pure php code ?
check this (the first tow paragraphs)
http://www.w3schools.com/php/php_file_upload.asp
If it works let inform us or else there is something with your server settings
vivekcu
(Vivekcu 08)
8
thanks for the repl
i wrote the code again from scratch and it worked…