Upload from frontend form doesn't work. Please help!


#1

Hello everybody,
For the past hours (days actually) I’ve been trying to upload a file from a frontend form in the website I’m working on.

The form itself works fine but the upload part is making me crazy.

The following code is the part of my controller which does the stuff:

try {

	$edition = $site->index()->filterBy('intendedTemplate', 'edition')->first();
	$year = $edition->children()->sortBy('title', 'desc')->first();
	$artists = $year->children()->sortBy('sort', 'asc')->first();
	$artist = $artists->children()->create(str_replace(' ', '-', $data['title']), 'artist', $data);

	$home = $site->index()->filterBy('intendedTemplate', 'home')->first();

	/* FILE
	===================================================================== */

	// if(isset($_FILES['file'])) {
	if($_POST['file'] != '') {

		$upload = new Upload($artist->root() . DS . '{safeFilename}', array(
			'input'     => 'file',
			'overwrite' => true
		));

		if($file = $upload->file()) {
			$success = 'A file has been uploaded';
		} else {
			dump($upload->error());
		}


	} else {
		$success = 'Niente file, ma registrazione effettuata!!!';
	}

} catch(Exception $e) {
	echo 'Your registration failed: ' . $e->getMessage();
}

I also tried with a different upload path, but this didn’t seem to solve the problem.
Any idea? I appreciate every type of help.

Thanks!
Sara


#2

Does it work if you try to. upload. to an already existing page (i.e. without creating a. new. page first)?

What exactly is the result of your code? Any error messages in the log?


#3

If I change directory writing:

$upload = new Upload($home->root() . DS . '{safeFilename}', array(
    'input'     => 'file',
    'overwrite' => true
));

instead of:

$upload = new Upload($artist->root() . DS . '{safeFilename}', array(
    'input'     => 'file',
    'overwrite' => true
));

I get the same error, and that’s why I don’t understand where the problem is.

The dump shows the following array (see next post 'cause it’s too long).


#4
Whoops\Exception\ErrorException Object
(
    [message:protected] => A non well formed numeric value encountered
    [string:Exception:private] => 
    [code:protected] => 8
    [file:protected] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/detect.php
    [line:protected] => 223
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/detect.php
                    [line] => 223
                    [function] => handleError
                    [class] => Whoops\Run
                    [type] => ->
                    [args] => Array
                        (
                            [0] => 8
                            [1] => A non well formed numeric value encountered
                            [2] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/detect.php
                            [3] => 223
                            [4] => Array
                                (
                                    [key] => post_max_size
                                    [size] => 8M
                                    [last] => m
                                )

                        )

                )

            [1] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/detect.php
                    [line] => 248
                    [function] => iniSize
                    [class] => Detect
                    [type] => ::
                    [args] => Array
                        (
                            [0] => post_max_size
                        )

                )

            [2] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/upload.php
                    [line] => 115
                    [function] => maxPostSize
                    [class] => Detect
                    [type] => ::
                    [args] => Array
                        (
                        )

                )

            [3] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/upload.php
                    [line] => 184
                    [function] => maxSize
                    [class] => Upload
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [4] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/upload.php
                    [line] => 192
                    [function] => messages
                    [class] => Upload
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [5] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/upload.php
                    [line] => 131
                    [function] => fail
                    [class] => Upload
                    [type] => ->
                    [args] => Array
                        (
                            [0] => 2
                        )

                )

            [6] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/upload.php
                    [line] => 44
                    [function] => move
                    [class] => Upload
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [7] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/site/controllers/artistsignup.php
                    [line] => 143
                    [function] => __construct
                    [class] => Upload
                    [type] => ->
                    [args] => Array
                        (
                            [0] => /Users/venezia/Desktop/art_website/content/home/{safeFilename}
                            [1] => Array
                                (
                                    [input] => file
                                    [overwrite] => 1
                                )

                        )

                )

            [8] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/core/page.php
                    [line] => 1515
                    [function] => {closure}
                    [class] => Kirby\Registry\Controller
                    [type] => ::
                    [args] => Array
                        (
                            [0] => Site Object
                                (
                                    [title] => Festival Artistidistrada
                                    [url] => http://192.168.0.36:8000
                                    [page] => festival/iscrizione-al-festival
                                    [content] => Content Object
                                        (
                                            [root] => /Users/venezia/Desktop/art_website/content/site.it.txt
                                            [fields] => Array
                                                (
                                                    [title] => Festival Artistidistrada
                                                    [logo] => art_logo15.svg
                                                    [address] => Festival Artistidistrada
c/o Masha Dimitri
Via Madonna della Fontana 3
6612 Ascona
(email: info@artistidistrada.ch text: info@artistidistrada.ch)
                                                    [email] => info@artistidistrada.ch
                                                    [copyright] => 
                                                    [credits] => Lucasdesign.ch
                                                    [facebook] => https://www.facebook.com/Festival-Artisti-di-Strada-Ascona-215204815173853
                                                    [creditsurl] => http://www.lucasdesign.ch
                                                    [ama] => Associazione Manifestazioni Ascona (AMA)
Casella postale 913
6612 Ascona
(email: info@amascona.ch text: info@amascona.ch)
                                                )

                                        )

                                    [children] => Children Object
                                        (
                                            [0] => festival
                                            [1] => artisti
                                            [2] => programma
                                            [3] => gallery
                                            [4] => chi-siamo
                                            [5] => edizioni-del-festival
                                            [6] => error
                                            [7] => home
                                            [8] => lista-degli-artisti-iscritti
                                            [9] => privacy-policy
                                        )

                                    [files] => Files Object
                                        (
                                            [0] => art_logo15.svg
                                        )

                                    [multilang] => 1
                                    [locale] => it_CH
                                    [user] => 
                                    [users] => Users Object
                                        (
                                            [0] => lucasdesign
                                        )

                                    [roles] => Roles Object
                                        (
                                            [0] => editor
                                            [1] => admin
                                            [2] => nobody
                                        )

                                    [languages] => Languages Object
                                        (
                                            [0] => it
                                            [1] => de
                                            [2] => fr
                                            [3] => en
                                        )

                                    [language] => it
                                    [defaultLanguage] => it
                                    [detectedLanguage] => it
                                    [visitorLanguage] => it
                                    [sessionLanguage] => 
                                )

                            [1] => Children Object
                                (
                                    [0] => festival
                                    [1] => artisti
                                    [2] => programma
                                    [3] => gallery
                                    [4] => chi-siamo
                                    [5] => edizioni-del-festival
                                    [6] => error
                                    [7] => home
                                    [8] => lista-degli-artisti-iscritti
                                    [9] => privacy-policy
                                )

                            [2] => Page Object
                                (
                                    [title] => Iscrizione al festival
                                    [id] => festival/iscrizione-al-festival
                                    [uid] => iscrizione-al-festival
                                    [slug] => iscrizione-al-festival
                                    [parent] => festival
                                    [uri] => festival/iscrizione-al-festival
                                    [url] => http://192.168.0.36:8000/festival/iscrizione-al-festival
                                    [contentUrl] => http://192.168.0.36:8000/content/1-festival/2-iscrizione-al-festival
                                    [tinyUrl] => http://192.168.0.36:8000/x/v5bd15
                                    [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival
                                    [dirname] => 2-iscrizione-al-festival
                                    [diruri] => 1-festival/2-iscrizione-al-festival
                                    [depth] => 2
                                    [num] => 2
                                    [hash] => v5bd15
                                    [modified] => c
                                    [template] => artistsignup
                                    [intendedTemplate] => artistsignup
                                    [isVisible] => 1
                                    [isOpen] => 1
                                    [isActive] => 1
                                    [isHomePage] => 
                                    [isErrorPage] => 
                                    [isCachable] => 1
                                    [isWritable] => 1
                                    [content] => Content Object
                                        (
                                            [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival/artistsignup.it.txt
                                            [fields] => Array
                                                (
                                                    [title] => Iscrizione al festival
                                                    [intro] => 
                                                    [authusername] => artist
                                                    [authpassword] => Sara1979!
                                                )

                                        )

                                    [headers] => 
                                    [children] => Children Object
                                        (
                                        )

                                    [siblings] => Children Object
                                        (
                                            [0] => festival/vuoi-partecipare
                                            [1] => festival/edizioni-passate
                                            [2] => festival/sponsor
                                        )

                                    [files] => Files Object
                                        (
                                        )

                                )

                            [3] => Array
                                (
                                )

                        )

                )

            [9] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/kirby/component/template.php
                    [line] => 35
                    [function] => controller
                    [class] => PageAbstract
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                )

                        )

                )

            [10] => Array
                (
                    [file] => /Users/venezia/Desktop/art_website/kirby/kirby/component/template.php
                    [line] => 87
                    [function] => data
                    [class] => Kirby\Component\Template
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Page Object
                                (
                                    [title] => Iscrizione al festival
                                    [id] => festival/iscrizione-al-festival
                                    [uid] => iscrizione-al-festival
                                    [slug] => iscrizione-al-festival
                                    [parent] => festival
                                    [uri] => festival/iscrizione-al-festival
                                    [url] => http://192.168.0.36:8000/festival/iscrizione-al-festival
                                    [contentUrl] => http://192.168.0.36:8000/content/1-festival/2-iscrizione-al-festival
                                    [tinyUrl] => http://192.168.0.36:8000/x/v5bd15
                                    [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival
                                    [dirname] => 2-iscrizione-al-festival
                                    [diruri] => 1-festival/2-iscrizione-al-festival
                                    [depth] => 2
                                    [num] => 2
                                    [hash] => v5bd15
                                    [modified] => c
                                    [template] => artistsignup
                                    [intendedTemplate] => artistsignup
                                    [isVisible] => 1
                                    [isOpen] => 1
                                    [isActive] => 1
                                    [isHomePage] => 
                                    [isErrorPage] => 
                                    [isCachable] => 1
                                    [isWritable] => 1
                                    [content] => Content Object
                                        (
                                            [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival/artistsignup.it.txt
                                            [fields] => Array
                                                (
                                                    [title] => Iscrizione al festival
                                                    [intro] => 
                                                    [authusername] => artist
                                                    [authpassword] => Sara1979!
                                                )

                                        )

                                    [headers] => 
                                    [children] => Children Object
                                        (
                                        )

                                    [siblings] => Children Object
                                        (
                                            [0] => festival/vuoi-partecipare
                                            [1] => festival/edizioni-passate
                                            [2] => festival/sponsor
                                        )

                                    [files] => Files Object
                                        (
                                        )

                                )

                            [1] => Array
                                (
                                )

                        )

                )

#5
[11] => Array
    (
        [file] => /Users/venezia/Desktop/art_website/kirby/kirby.php
        [line] => 681
        [function] => render
        [class] => Kirby\Component\Template
        [type] => ->
        [args] => Array
            (
                [0] => Page Object
                    (
                        [title] => Iscrizione al festival
                        [id] => festival/iscrizione-al-festival
                        [uid] => iscrizione-al-festival
                        [slug] => iscrizione-al-festival
                        [parent] => festival
                        [uri] => festival/iscrizione-al-festival
                        [url] => http://192.168.0.36:8000/festival/iscrizione-al-festival
                        [contentUrl] => http://192.168.0.36:8000/content/1-festival/2-iscrizione-al-festival
                        [tinyUrl] => http://192.168.0.36:8000/x/v5bd15
                        [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival
                        [dirname] => 2-iscrizione-al-festival
                        [diruri] => 1-festival/2-iscrizione-al-festival
                        [depth] => 2
                        [num] => 2
                        [hash] => v5bd15
                        [modified] => c
                        [template] => artistsignup
                        [intendedTemplate] => artistsignup
                        [isVisible] => 1
                        [isOpen] => 1
                        [isActive] => 1
                        [isHomePage] => 
                        [isErrorPage] => 
                        [isCachable] => 1
                        [isWritable] => 1
                        [content] => Content Object
                            (
                                [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival/artistsignup.it.txt
                                [fields] => Array
                                    (
                                        [title] => Iscrizione al festival
                                        [intro] => 
                                        [authusername] => artist
                                        [authpassword] => Sara1979!
                                    )

                            )

                        [headers] => 
                        [children] => Children Object
                            (
                            )

                        [siblings] => Children Object
                            (
                                [0] => festival/vuoi-partecipare
                                [1] => festival/edizioni-passate
                                [2] => festival/sponsor
                            )

                        [files] => Files Object
                            (
                            )

                    )

                [1] => Array
                    (
                    )

            )

    )

[12] => Array
    (
        [file] => /Users/venezia/Desktop/art_website/kirby/kirby.php
        [line] => 669
        [function] => template
        [class] => Kirby
        [type] => ->
        [args] => Array
            (
                [0] => Page Object
                    (
                        [title] => Iscrizione al festival
                        [id] => festival/iscrizione-al-festival
                        [uid] => iscrizione-al-festival
                        [slug] => iscrizione-al-festival
                        [parent] => festival
                        [uri] => festival/iscrizione-al-festival
                        [url] => http://192.168.0.36:8000/festival/iscrizione-al-festival
                        [contentUrl] => http://192.168.0.36:8000/content/1-festival/2-iscrizione-al-festival
                        [tinyUrl] => http://192.168.0.36:8000/x/v5bd15
                        [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival
                        [dirname] => 2-iscrizione-al-festival
                        [diruri] => 1-festival/2-iscrizione-al-festival
                        [depth] => 2
                        [num] => 2
                        [hash] => v5bd15
                        [modified] => c
                        [template] => artistsignup
                        [intendedTemplate] => artistsignup
                        [isVisible] => 1
                        [isOpen] => 1
                        [isActive] => 1
                        [isHomePage] => 
                        [isErrorPage] => 
                        [isCachable] => 1
                        [isWritable] => 1
                        [content] => Content Object
                            (
                                [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival/artistsignup.it.txt
                                [fields] => Array
                                    (
                                        [title] => Iscrizione al festival
                                        [intro] => 
                                        [authusername] => artist
                                        [authpassword] => Sara1979!
                                    )

                            )

                        [headers] => 
                        [children] => Children Object
                            (
                            )

                        [siblings] => Children Object
                            (
                                [0] => festival/vuoi-partecipare
                                [1] => festival/edizioni-passate
                                [2] => festival/sponsor
                            )

                        [files] => Files Object
                            (
                            )

                    )

                [1] => Array
                    (
                    )

            )

    )

[13] => Array
    (
        [file] => /Users/venezia/Desktop/art_website/kirby/kirby/component/response.php
        [line] => 29
        [function] => render
        [class] => Kirby
        [type] => ->
        [args] => Array
            (
                [0] => Page Object
                    (
                        [title] => Iscrizione al festival
                        [id] => festival/iscrizione-al-festival
                        [uid] => iscrizione-al-festival
                        [slug] => iscrizione-al-festival
                        [parent] => festival
                        [uri] => festival/iscrizione-al-festival
                        [url] => http://192.168.0.36:8000/festival/iscrizione-al-festival
                        [contentUrl] => http://192.168.0.36:8000/content/1-festival/2-iscrizione-al-festival
                        [tinyUrl] => http://192.168.0.36:8000/x/v5bd15
                        [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival
                        [dirname] => 2-iscrizione-al-festival
                        [diruri] => 1-festival/2-iscrizione-al-festival
                        [depth] => 2
                        [num] => 2
                        [hash] => v5bd15
                        [modified] => c
                        [template] => artistsignup
                        [intendedTemplate] => artistsignup
                        [isVisible] => 1
                        [isOpen] => 1
                        [isActive] => 1
                        [isHomePage] => 
                        [isErrorPage] => 
                        [isCachable] => 1
                        [isWritable] => 1
                        [content] => Content Object
                            (
                                [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival/artistsignup.it.txt
                                [fields] => Array
                                    (
                                        [title] => Iscrizione al festival
                                        [intro] => 
                                        [authusername] => artist
                                        [authpassword] => Sara1979!
                                    )

                            )

                        [headers] => 
                        [children] => Children Object
                            (
                            )

                        [siblings] => Children Object
                            (
                                [0] => festival/vuoi-partecipare
                                [1] => festival/edizioni-passate
                                [2] => festival/sponsor
                            )

                        [files] => Files Object
                            (
                            )

                    )

            )

    )

[14] => Array
    (
        [file] => /Users/venezia/Desktop/art_website/kirby/kirby.php
        [line] => 751
        [function] => make
        [class] => Kirby\Component\Response
        [type] => ->
        [args] => Array
            (
                [0] => Page Object
                    (
                        [title] => Iscrizione al festival
                        [id] => festival/iscrizione-al-festival
                        [uid] => iscrizione-al-festival
                        [slug] => iscrizione-al-festival
                        [parent] => festival
                        [uri] => festival/iscrizione-al-festival
                        [url] => http://192.168.0.36:8000/festival/iscrizione-al-festival
                        [contentUrl] => http://192.168.0.36:8000/content/1-festival/2-iscrizione-al-festival
                        [tinyUrl] => http://192.168.0.36:8000/x/v5bd15
                        [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival
                        [dirname] => 2-iscrizione-al-festival
                        [diruri] => 1-festival/2-iscrizione-al-festival
                        [depth] => 2
                        [num] => 2
                        [hash] => v5bd15
                        [modified] => c
                        [template] => artistsignup
                        [intendedTemplate] => artistsignup
                        [isVisible] => 1
                        [isOpen] => 1
                        [isActive] => 1
                        [isHomePage] => 
                        [isErrorPage] => 
                        [isCachable] => 1
                        [isWritable] => 1
                        [content] => Content Object
                            (
                                [root] => /Users/venezia/Desktop/art_website/content/1-festival/2-iscrizione-al-festival/artistsignup.it.txt
                                [fields] => Array
                                    (
                                        [title] => Iscrizione al festival
                                        [intro] => 
                                        [authusername] => artist
                                        [authpassword] => Sara1979!
                                    )

                            )

                        [headers] => 
                        [children] => Children Object
                            (
                            )

                        [siblings] => Children Object
                            (
                                [0] => festival/vuoi-partecipare
                                [1] => festival/edizioni-passate
                                [2] => festival/sponsor
                            )

                        [files] => Files Object
                            (
                            )

                    )

            )

    )

[15] => Array
    (
        [file] => /Users/venezia/Desktop/art_website/index.php
        [line] => 16
        [function] => launch
        [class] => Kirby
        [type] => ->
        [args] => Array
            (
            )

    )

)

[previous:Exception:private] => 
[severity:protected] => 8
)

#6

How big is that file your are trying to upload?


#7

It’s only 150 KB, I’m not even close to the post_max_size. :sleepy:


#8

Ok, I just found out something interesting.
In my content .txt file there’s the information about the image I tried to upload:

Title: Artist name

----

Nationality: CH/GB/HR/US

----

Showtitle: Show title

----

Showtype: Show type

----

Showdescription: Show description

----

File: CucciaGatto.jpg

So why the file isn’t actually in the folder? Do I miss something in my code?


#9

I can’t look into this now. will get back to you. later if nobody. else does.


#10

No problem, of course. Thank you so much!


#11

Not online for long but check your php.ini file for the “max_post_size” line, make sure there is no extra white space or characters which shouldn’t be there

(
                        [0] => 8
                        [1] => A non well formed numeric value encountered
                        [2] => /Users/venezia/Desktop/art_website/kirby/vendor/getkirby/toolkit/lib/detect.php
                        [3] => 223
                        [4] => Array
                            (
                                [key] => post_max_size
                                [size] => 8M
                                [last] => m
                            )

                    )

the above array and looking at the code in question:

  public static function iniSize($key) {

$size = ini_get($key);
$size = trim($size);
$last = strtolower($size[strlen($size)-1]);
switch($last) {
  case 'g':
    $size *= 1024;
  case 'm':
    $size *= 1024;
  case 'k':
    $size *= 1024;
}
    return $size;    

  }

points to it trying to multiply the word ‘8M’ with the number 1024, which won’t return a valid integer.


#12

Looked into it further and I think it’s a bug in kirby and I’m assuming you’re running php 7.1+?
Haven’t been able to replicate it as I’m running 7.0 but it sounds a lot like this

sounds like you can fix it by running an intval() something like this:
public static function iniSize($key) {

$size = ini_get($key);
$size = intval(trim($size));
$last = strtolower($size[strlen($size)-1]);
switch($last) {
  case 'g':
    $size *= 1024;
  case 'm':
    $size *= 1024;
  case 'k':
    $size *= 1024;
}
return $size;    

}

replacing from line 214 in kirby/vendor/getkirby/toolkit/lib/detect.php, will report on github for further investigation


#13

Thanks for creating the issue on GitHub. I had seen that as well.


#14

Hi wipey,

Thanks for your reply.
I tried to add intval to the detect.php, as you suggest.

I get this screen from the debug:

Unfortunately I’m not so good in backend, and I don’t understand what could be the problem/mistake.
I don’t even have a colleague to ask to, as I’m the only programmer here. :cry:


#15

I’m not sure about the PHP version on our webserver, as I’m not managing it.
Anyway I tried to upload the entire project and leave the detect.php file as the original, thinking that maybe it would work, but it doesn’t.


#16

give me 5 mins and I’ll update my server and test


#17

I don’t know how to thank you. Anyway absolutely no rush. I’m going home in a few and be back only tomorrow morning.
Plus this project is already online. The part I’m working on right now won’t be needed until the end of the year. :wink:


#18

Not sure on second error but my fix posted works on my server, second error could be you referencing the wrong var hence uploading nothing

// if(isset($_FILES['file'])) {
if($_POST['file'] != '') {

sounds a bit iffy, are you checking for the right var? in this bit it might not be pointing to the right bit of form data, if you have a live version I could look at it would help a lot.

$upload = new Upload($artist->root() . DS . '{safeFilename}', array(
		'input'     => 'file',
		'overwrite' => true
	));

that’s all the input I have without having it infront of me


#19

Hi Neil,

I really don’t know how to thank you for the time you’re spending helping me.
Yes, I have the project on a development server, at the following link:
https://dev.lucasdesign.ch/ART/website/

As I don’t know if you need to access the panel of my project (at least to see if the image is actually upload) I created a new brand user just for you. User and password are coming in a private message.

Right now the code creates a new subpage in the page (dashboard) “Festival editions > 2019 > Artists”.
I also tried to change the path and upload the file in the homepage but it didn’t work as well.

You’ll find the form at the page “Festival > Registration at the festival”.
Username and password for the first part are coming in a private message.

The page “Artists” shows all the subpages created. There’s a default picture if a new one hasn’t been uploaded.

Please take your time and I hope, one day, to be able to help you as you’re doing with me.
Sara

P.S.: I have a copy of the project on Bitbucket if you need to see the source codes. Just let me know if you want access to it.


#20

@wipey is right, it should actually be $_FILES, not $_POST.

          if(isset($_FILES['file'])) {

                    try {
                   		$upload = new Upload($page->root() . DS . '{safeFilename}', array('input' => 'file'));


                   } catch(Exception $e) {
                   	dump('Your registration failed: ' . $e->getMessage());
                   }
                 }

With that change, the code works in my environment without any issues (MAMP, PHP 7.1.x)