Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

file upload + jquery ajax + phalcon - ASAP!

Hello,

I am trying to upload a file with jquery's -> $.ajax(); <- method The problem is that it works using plain PHP, but I am not getting the actual values if using Phalcon. Here's some sample code:

.. formData = new FormData($(this)[0]); $.ajax({ url: "/upload", type: 'POST', data: formData, async: false, cache: false, contentType: false, processData: false, success: function (data) { console.log(data); } });

phalcon see's that the request is been made via POST and AJAX but it's not getting the actual submited information. If this is supported by Phalcon? How the serverside code should look like?!

Thank you!

Hi, could you post relevant php and phalcon code somewhere so that we could take a look?

you cannot use phalcon\http\request\file (if you are using) for ajax/xhr file uploads, you have to get data from POST.



2.5k
Accepted
answer

Yes I know. I fixed it.

It was a problem with jquery and still is. I had it working with a pure javascript ajax request. Thank you!