0

I got a file upload form using enctype=multipart/form-data, but my $_FILES array is always empty. max_upload_size is big enough (2MB, I'm testing with 100kb files). the exactly same code is working on other hosts, so I think something is wrong with my webhoster's php settings. does anyone know what I could check for? when I ask them they always tell me it can't be their fault -_-

EDIT:

You asked for code, I didn't post it because it's pretty complicated (a Shopware plugin), but I think I can extract the important parts:

HTML (Smarty):

<form method="post" action="{url action=saveRegister}" enctype="multipart/form-data">

PHP (inside my event handler):

file_put_contents('ul.log',serialize($_FILES));

Result (var_dumped unserialized):

array(0) {}

Full Form HTML: http://pastebin.com/Wq1yBTux

18
  • 4
    Is your code confidential to post it here ? Commented Dec 13, 2013 at 9:23
  • Check the permissions on the folder you are trying to upload to Commented Dec 13, 2013 at 9:24
  • Check the phpinfo outputs Commented Dec 13, 2013 at 9:26
  • 1
    @PatsyIssa the move hasn't been made yet, the file should be in the tmp folder and the $_FILES array would be populated, we aren't at the stage that the file cannot be moved to the upload directory yet Commented Dec 13, 2013 at 9:27
  • Check for suhosin parameters, they can be very tricky. Commented Dec 13, 2013 at 9:27

2 Answers 2

1

Found the error: some "security feature" of the framework "cleaned up" $_POST, so move_uploaded_file couldn't check if the file was uploaded correctly

Sign up to request clarification or add additional context in comments.

Comments

0

Install Firebug (see network tab) or Livehttpheaders to see if your file is actually sent to the server and if the HTTP headers are correctly send by the browser.

They might be wrong for any reason (Content-Type not allowed, POST method not allowed)

It should give you data to look at and configuration parameters to check.

1 Comment

it's sent in my request ------WebKitFormBoundaryQyQAQArrBFT70bfD Content-Disposition: form-data; name="upload"; filename="technikdirekt1.png" Content-Type: image/png and I get HTTP 200.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.