Welcome Guest, Not a member yet? Register   Sign In
File Upload Validation Broke
#15

(This post was last modified: 04-25-2020, 09:19 AM by Leo.)

I confirm uploading with AJAX using CI's getFile() does not work. Either it is bugged or it's not meant to be used with AJAX (or I have an error in my code) - and we should use something else. Here is a quick test.
Simple tests:
PHP Code:
public function upload_with_ajax_not_working()
{
    if ($this->request->isAJAX()) {

        $test $this->request->getFile('file');
        $response['status'] = json_encode($test);

        return $this->response->setJSON($response);
    }
    return '{"error":"Invalid Request"}';
}

public function 
upload_with_ajax_working()
{
    if ($this->request->isAJAX()) {

        $test $_FILES['file'];
        $response['status'] = json_encode($test);

        return $this->response->setJSON($response);
    }
    return '{"error":"Invalid Request"}';

You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
Reply


Messages In This Thread
File Upload Validation Broke - by Gary - 04-12-2020, 11:51 AM
RE: File Upload Validation Broke - by Gary - 04-14-2020, 07:00 PM
RE: File Upload Validation Broke - by Gary - 04-23-2020, 02:06 PM
RE: File Upload Validation Broke - by Leo - 04-23-2020, 02:49 PM
RE: File Upload Validation Broke - by Gary - 04-23-2020, 03:18 PM
RE: File Upload Validation Broke - by Leo - 04-23-2020, 03:55 PM
RE: File Upload Validation Broke - by Gary - 04-24-2020, 08:47 AM
RE: File Upload Validation Broke - by Leo - 04-24-2020, 02:31 PM
RE: File Upload Validation Broke - by Gary - 04-24-2020, 03:03 PM
RE: File Upload Validation Broke - by Leo - 04-24-2020, 03:09 PM
RE: File Upload Validation Broke - by Gary - 04-24-2020, 03:40 PM
RE: File Upload Validation Broke - by Leo - 04-24-2020, 03:46 PM
RE: File Upload Validation Broke - by Gary - 04-24-2020, 03:58 PM
RE: File Upload Validation Broke - by Leo - 04-25-2020, 01:13 AM
RE: File Upload Validation Broke - by Leo - 04-25-2020, 02:56 AM
RE: File Upload Validation Broke - by Gary - 04-28-2020, 09:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB