Hi,
I'm trying to send uploaded files without form using Ajax. I've a problem with FormData. Here my example:
HTML
- <input type="file" name="file" class="jfilestyle" data-theme="blue" data-input="true" data-buttonText="<i class='fa fa-upload' aria-hidden='true'></i>" >
JQUERY:
- var myfile = $(':file').prop('files')[0];
- var data = new FormData();
- data.append('file',myfile);
- var mytest= "test";
- $.ajax({
- type:'POST',
- url:'test.php',
- data{
- data:data,
- mytest:mytest
- },
- processData:false,
- contentType:false,
- success:function(data){
- alert("data.myFile");
- }
- });
I can't read the uploaded file in my "test.php" page? How can i do that? Can you show me an example?
Thank You very Much!
Manuel