3

I know that this sends stuff to a php file and gets stuff returned from the php file as javascript:

 $.ajax({
   type: "POST",
   url: "phpfile",
   cache: false,
   data: datahere,
   dataType: "script"
 });

But... suppose "datahere" is a file from a input file element. How am I supposed to get the value or data from that upload input file element?

2 Answers 2

3

Take a look at these plugins: 7 trusted ajax file upload plugins using jquery

Those are some AJAX file upload plugins. They might be what you need.

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

Comments

1
 $.ajax({
   type: "POST",
   url: "phpfile",
   cache: false,
   data: $('.thisInput').val(),
   dataType: "script"
 });

2 Comments

thanks for yuor reply imoda, but that will only send the url of the file... not the actual file itself
That's all you need to handle the form.

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.