Skip to content Skip to sidebar Skip to footer

Combine $_files And $_post Into One Ajax Call With Javascript Only

I am having difficulty sending an ajax call that contains both a file and a string. I have no difficulty making either post or file, but not both together. I need this in pure Java

Solution 1:

Looks like you want the value of _('title') to be added to the formdata.

Given that you have this:

formdata.append("video", file);

All you need to do is this:

formdata.append('title', title);

The FormData object will handle the transmission of the file, and title will be available as $_POST['title'];

Post a Comment for "Combine $_files And $_post Into One Ajax Call With Javascript Only"