Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

file upload javascript

<script>
async function uploadFile() {
    let formData = new FormData();           
    formData.append("file", fileupload.files[0]);
    await fetch('/upload.php', {
      method: "POST", 
      body: formData
    });    
    alert('The file has been uploaded successfully.');
}
</script>
Comment

File Upload Button and display file javascript

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
  <label for="file-upload" class="custom-file-upload">
    <i class="fa fa-cloud-upload"></i> Upload Image
  </label>
  <input id="file-upload" name='upload_cont_img' type="file" style="display:none;">
</form>
Comment

file upload javascript

<input id="fileupload" type="file" name="fileupload" />
<button id="upload-button" onclick="uploadFile()"> Upload </button>
Comment

javascript upload file button

<input id='fileid' type='file' hidden/>
<input id='buttonid' type='button' value='Upload MB' />
Comment

File Upload Button and display file javascript

.custom-file-upload {
  border: 1px solid #ccc;
  display: inline-block;
  padding: 6px 12px;
  cursor: pointer;
}
Comment

javascript upload file button

document.getElementById('buttonid').addEventListener('click', openDialog);

function openDialog() {
  document.getElementById('fileid').click();
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: index of javascript 
Javascript :: jsx map with index 
Javascript :: add pdf in react app 
Javascript :: how to create a json server 
Javascript :: formdata is empty after append in angular 
Javascript :: new features of angular 11 
Javascript :: expected an identifier and instead saw const 
Javascript :: javascript create a multidimensional array 
Javascript :: javascript typed array 
Javascript :: vue router Async Scrolling 
Javascript :: javascript find area of triangle 
Javascript :: version check 
Javascript :: sequelize exclude attributes 
Javascript :: change dictionary value in React js 
Javascript :: get response from window.open 
Javascript :: addeventlistener javascript multiple functions 
Javascript :: ag grid angular examples 
Javascript :: angular blank page no errors 
Javascript :: setTimeout() nodejs 
Javascript :: rename column infotable thingworx 
Javascript :: last index of string in javascript 
Javascript :: node express tutorial 
Javascript :: How to make a JSON call to an URL 
Javascript :: palindrome checker 
Javascript :: yarn create react app in current directory 
Javascript :: chess.js 
Javascript :: display a div only seconds js 
Javascript :: push object into array javascript 
Javascript :: fluent validation email address regex 
Javascript :: how to get today in moment js 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =