$_FILE in a function

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Re: $_FILE in a function

Postby Altrea » 14. October 2015 16:31

ken_mayer wrote:This is what I get:

Code: Select all
Array ( [armory] => Array ( [name] => CJ_and_Ken_Lainas_Party.jpg [type] => image/jpeg [tmp_name] => C:\xampp\tmp\php6A3A.tmp [error] => 0 [size] => 60897 ) )


This doesn't tell me what to use to reference the information correctly.

That's not correct. Let me write this a little bit more clearly for you.
Code: Select all
$_FILES = array(
    'armory' => array(
        'name' => 'CJ_and_Ken_Lainas_Party.jpg',
        'type' => 'image/jpeg',
        'tmp_name' => 'C:\xampp\tmp\php6A3A.tmp',
        'error' => '0',
        'size' => '60897'
    )
);
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11935
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: $_FILE in a function

Postby ken_mayer » 14. October 2015 16:47

After much experimentation, I found that my original call needed to be the name of the input control, so the function call itself needed to be changed to:

Code: Select all
$msg = fileUpload( 'armory', $armory_path );


It appears to be working, although I also had to modify the call to the function to move the file to the file location:

Code: Select all
if ( move_uploaded_file($_FILES[$filename]['tmp_name'], $uploadpath.$_FILES[$filename]['name'] ))


Using the $filename variable didn't work, it was assumed to be a folder path, but changing it to the $_FILES... call seems to have resolved that as well.
ken_mayer
 
Posts: 9
Joined: 14. October 2015 14:26
Operating System: Windows 10

Previous

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 126 guests