Hi guys,
following method will show each file in browser using external programs
public function actionFile($filename, $id) {
$session = new Session();
$model_folder = Dateianhang::findOne(['id' => $id]);
$folder_read = "/" . AppEinstellung::getSpeicherOrt($model_folder) . "/";
$folder_base = Yii::getAlias('@app');
$folder_read = $folder_base . $folder_read;
if (!is_file("$folder_read/$filename")) {
$model = Dateianhang::findOne(['id' => $id]);
$id = EDateianhang::findOne(['id' => $model->id_e_dateianhang])->id_person;
$session->addFlash("warning", "Die angeforderte Datei befindet sich nicht(mehr)auf Ihrem Server");
return $this->redirect(['index', 'id' => $id]);
}
//gib das Dokument im Browser aus
return Yii::$app->response->sendFile("$folder_read/$filename");
}
What about doing same thing, if file is not in my local folder but at another webserver. Coding like this will show pictures without any problems.
public function actionFile() {
$url_moi = "http://tklustig.ddns.net:1025/img/tklustig.jpg";
//gib das Dokument im Browser aus
return Html::img($url_moi, ['alt' => 'pic not found']);
}
Coding like this will show documents in browser:
public function actionFile($filename, $id) {
$url = "http://tklustig.ddns.net:1025/img/Merksatz.docx";
$url1 = "http://tklustig.ddns.net:1025/img/Uploadlogik.pdf";
$url2 = "http://tklustig.ddns.net:1025/img/Netzwerk.txt";
$this->redirect([$url]);
}
[font="Arial"][size="2"]First url(Merksatz.docx) will be shown starting MSOffice, without influencing application in a special tab[/size][/font]
[font=“Arial”][size=“2”]That’s what I want!
[/size][size="2"]Second and third url will replace application in tab instead starting Adobe or another Editor[/size][/font]
[font=“Arial”][size=“2”]That’s, want i don’t want!
[/size][/font][color="#333333"][font="Arial"][size="2"]Is there a way to open all documents in a different/special tab?[/size][/font][/color]