Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

send a file ajax

var formData = new FormData();
formData.append('file', $('#file')[0].files[0]);

$.ajax({
       url : 'upload.php',
       type : 'POST',
       data : formData,
       processData: false,  // tell jQuery not to process the data
       contentType: false,  // tell jQuery not to set contentType
       success : function(data) {
           console.log(data);
           alert(data);
       }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: sort array of object js 
Javascript :: python convert requests response to json 
Javascript :: javascript format currency 
Javascript :: empty select option jquery 
Javascript :: google script for loop 
Javascript :: javascript convert px to vw 
Javascript :: reactjs sass setup 
Javascript :: javascrip reverse text 
Javascript :: jquery set attribute stack overflow 
Javascript :: jquery remove br from div 
Javascript :: copyright in javascript 
Javascript :: jquery form id submit 
Javascript :: typescript read url parameters 
Javascript :: how to resolve @fortawesome/free-solid-svg-icons in react 
Javascript :: turn object into string javascript 
Javascript :: javascript add script in head programmatically 
Javascript :: jquery smooth scrool 
Javascript :: js get viewport width 
Javascript :: remove tr in table jquery 
Javascript :: update node .js 
Javascript :: how to get all elements with same class in jquery 
Javascript :: regex email js 
Javascript :: js get first space in string 
Javascript :: jquery insert after 
Javascript :: jquery ajax post form 
Javascript :: how to insalk react router with npm 
Javascript :: selected option attribute jquery 
Javascript :: how to remove last char from string in javascript 
Javascript :: javascript readfile 
Javascript :: clz32 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =