doggo upload
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
This commit is contained in:
@ -77,6 +77,53 @@ class Dogs extends Page {
|
||||
$dog_size = $_REQUEST['dog_size'];
|
||||
$dog_birthday = $_REQUEST['dog_birthday'];
|
||||
$agi_height_category = $_REQUEST['agi_height_category'];
|
||||
$newphoto = false;
|
||||
|
||||
if($_FILES['photo'])
|
||||
{
|
||||
$photo = $_FILES['photo'];
|
||||
$photo_name = $photo['name'];
|
||||
$photo_tmp_name = $photo['tmp_name'];
|
||||
$photo_size = $photo['size'];
|
||||
$photo_error = $photo['error'];
|
||||
$photo_type = $photo['type'];
|
||||
|
||||
$allowed = ['jpg','jpeg','png'];
|
||||
$photo_ext = strtolower(end(explode('.', $photo_name)));
|
||||
$photo_name = $name.'.'.$photo_ext;
|
||||
$photo_path = 'uploads/'.$photo_name;
|
||||
|
||||
if(in_array($photo_ext, $allowed))
|
||||
{
|
||||
if($photo_error === 0)
|
||||
{
|
||||
if($photo_size < 10000000)
|
||||
{
|
||||
$answer = pictshareUploadImage($photo_tmp_name);
|
||||
if($answer['status']=='ok' && in_array($answer['filetype'],['jpeg','png','gif']))
|
||||
$newphoto = $answer['url'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set('errorMessage', 'Die Datei ist zu groß. Bitte eine kleinere Datei hochladen');
|
||||
$this->set('template', '/templates/partials/error.html');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set('errorMessage', 'Beim Upload der Datei ist ein Fehler aufgetreten');
|
||||
$this->set('template', '/templates/partials/error.html');
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->set('errorMessage', 'Dieser Dateityp ist nicht erlaubt. Bitte nur jpg, jpeg oder png Dateien hochladen');
|
||||
$this->set('template', '/templates/partials/error.html');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$error = false;
|
||||
if(!$name || !$dog_birthday )
|
||||
@ -101,6 +148,8 @@ class Dogs extends Page {
|
||||
$dog->size = $dog_size;
|
||||
$dog->birthday = $dog_birthday;
|
||||
$dog->agility_size = $agi_height_category;
|
||||
if($newphoto)
|
||||
$dog->photo = $newphoto;
|
||||
|
||||
try
|
||||
{
|
||||
@ -160,7 +209,11 @@ class Dogs extends Page {
|
||||
|
||||
if(!$d->isMyDog($dogid))
|
||||
return 'Not your dog :(';
|
||||
return 'hier wird der hund angezeigt';
|
||||
|
||||
$d->load($dogid);
|
||||
$this->set('dogdata', $d->data);
|
||||
$this->set('dogid', $dogid);
|
||||
$this->set('template', 'dog.html');
|
||||
}
|
||||
|
||||
function maySeeThisPage() {
|
||||
|
Reference in New Issue
Block a user