How I can upload a javascript file using ajax once I resize an image in a manner where $_FILES can be used in php

Dimitrios Desyllas - Dec 9 '22 - - Dev Community

In my case, I had to resize an image then uploaded as a normal file. Many sources suggest that in order for this php code to work:

$file = $_FILES['base_img_data'];

if($file['tmp_name']){
  echo "FILE UPLOADED";
  exit;
}

echo "FILE NOT UPLOADED";
Enter fullscreen mode Exit fullscreen mode

Needs this form:

<form id="upload_form" method="post" action="..."  enctype="multipart/form-data">
   <input type="file" name="base_img_data" />
   <button type="submit" id="savebtn" disabled>Save me</button>
</form>
Enter fullscreen mode Exit fullscreen mode

But according to this stackoverflow answer I say NO you can upload using ajax, AFTER you process it.

Read more on Stackoverflow answer.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player