1

I am at a complete loss with this one. I use this to submit images without refresh:

$.ajax(
    {
        url:"<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>",
        type:"POST",
        data:X,
        cache:false,
        processData:false,
        contentType:false,
        beforeSend:function()
     });

but I have php verification to make sure there are only a limited number of images selected

if((sizeof($_FILES['IMAGE']) + $IMAGE_COUNT) > $POST_MAX_IMAGES)

For some reason, sizeof($_FILES['IMAGE'] is constantly stuck at 5??? I can't get a proper count of the number of files selected. Its always at 5. But if I do foreach on the $_FILES, it will go through all of them.

Why is this happening?

4
  • Try checking the max_file_uploads setting in php.ini Commented Mar 19, 2014 at 2:26
  • ajax by itself does not support file upload... unless you are using FormData Commented Mar 19, 2014 at 2:41
  • Its at 20... this is weird because I can upload 25 images at once... but if I delete the images using ajax as well, going down to 20, I cannot upload back to 25 again. But I checked my $_FILES and its always return a value of 5 Commented Mar 19, 2014 at 2:43
  • I use FormData, x is the FormData taken from that form Commented Mar 19, 2014 at 2:44

1 Answer 1

1

I found the solution to be

$_FILES['IMAGE']['name']

instead of

$_FILES['IMAGE']

Still curious about why, but it works

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

Comments

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.