File uploads fixes.
This commit is contained in:
1 parent
462bad096a
commit
f58ae1bc8a
4 files changed
+22
-14
No files matched your search
+9
-5
@@ -45,7 +45,8 @@ class Article {
|
||||
if($_FILES['attachment1']['error'] != 4){
|
||||
$temp_name = new_file($_FILES['attachment1'], 'nyheter');
|
||||
rename_file($temp_name, $this->id, 'nyheter');
|
||||
$this->attachment1 = $this->id.substr($temp_name, -4);
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->attachment1 = $this->id . "." . $ext;
|
||||
}else {
|
||||
$this->attachment1 = 0;
|
||||
}
|
||||
@@ -54,7 +55,8 @@ class Article {
|
||||
if($_FILES['attachment2']['error'] != 4){
|
||||
$temp_name = new_file($_FILES['attachment2'], 'nyheter');
|
||||
rename_file($temp_name, $this->id.'_2', 'nyheter');
|
||||
$this->attachment2 = $this->id.'_2'.substr($temp_name, -4);
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->attachment2 = $this->id . "_2." . $ext;
|
||||
}else {
|
||||
$this->attachment2 = 0;
|
||||
}
|
||||
@@ -101,7 +103,8 @@ class Article {
|
||||
if($_FILES['attachment1']['error'] != 4){
|
||||
$temp_name = new_file($_FILES['attachment1'], 'nyheter');
|
||||
rename_file($temp_name, $this->id, 'nyheter');
|
||||
$this->attachment1 = $this->id.substr($temp_name, -4);
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->attachment1 = $this->id . "." . $ext;
|
||||
}else {
|
||||
$this->attachment1 = 0;
|
||||
}
|
||||
@@ -110,7 +113,8 @@ class Article {
|
||||
if($_FILES['attachment2']['error'] != 4){
|
||||
$temp_name = new_file($_FILES['attachment2'], 'nyheter');
|
||||
rename_file($temp_name, $this->id.'_2', 'nyheter');
|
||||
$this->attachment2 = $this->id.'_2'.substr($temp_name, -4);
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->attachment1 = $this->id . "_2." . $ext;
|
||||
}else {
|
||||
$this->attachment2 = 0;
|
||||
}
|
||||
@@ -267,4 +271,4 @@ class Article {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
+4
-3
@@ -80,7 +80,8 @@ class Concert {
|
||||
if( $_FILES['userfile']['error'] != 4 ) {
|
||||
$temp_name = new_file($_FILES['userfile'], "program");
|
||||
rename_file($temp_name, $this->id, "program");
|
||||
$this->picture = $this->id.substr($temp_name, -4);
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->picture = $this->id . "." . $ext;
|
||||
}
|
||||
|
||||
$this->links = $data['links'];
|
||||
@@ -142,8 +143,8 @@ class Concert {
|
||||
$this->id = getNextId("program");
|
||||
if($_FILES['userfile']['error'] != 4){
|
||||
$temp_name = new_file($_FILES['userfile'], "program");
|
||||
rename_file($temp_name, $this->id, "program");
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
rename_file($temp_name, $this->id, "program");
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->picture = $this->id . "." . $ext;
|
||||
} else {
|
||||
$this->picture = "0";
|
||||
|
||||
+4
-3
@@ -81,10 +81,11 @@ class Division {
|
||||
}
|
||||
}else {//ID set, existing article
|
||||
if ($data != NULL){//Update existing article
|
||||
if($_FILES['userfile']['error'] != 4){
|
||||
$temp_name = new_file($_FILES, "foreninger");
|
||||
if($_FILES['userfile']['error'] != 4) {
|
||||
$temp_name = new_file($_FILES['userfile'], "foreninger");
|
||||
rename_file($temp_name, $this->id, "foreninger");
|
||||
$this->picture = $this->conn->quoteSmart($this->id.substr($temp_name, -4));
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->picture = $this->id . "." . $ext;
|
||||
}else {
|
||||
$this->picture = "picture";
|
||||
}
|
||||
|
||||
+5
-3
@@ -34,7 +34,8 @@ class Product {
|
||||
if($_FILES['userfile']['error'] != 4){
|
||||
$temp_name = new_file($_FILES['userfile'], 'products');
|
||||
rename_file($temp_name, $this->id, 'products');
|
||||
$this->picture = $this->id.substr($temp_name, -4);
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->picture = $this->id . "." . $ext;
|
||||
}else {
|
||||
$this->picture = 0;
|
||||
}
|
||||
@@ -72,7 +73,8 @@ class Product {
|
||||
if($_FILES['userfile']['error'] != 4){
|
||||
$temp_name = new_file($_FILES['userfile'], 'products');
|
||||
rename_file($temp_name, $this->id, 'products');
|
||||
$this->picture = $this->id.substr($temp_name, -4);
|
||||
$ext = strtolower( pathinfo($temp_name, PATHINFO_EXTENSION) );
|
||||
$this->picture = $this->id . "." . $ext;
|
||||
}else {
|
||||
$this->picture = 0;
|
||||
}
|
||||
@@ -334,4 +336,4 @@ AND t.status = 'OK' " .
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in new issue
Block a user