Click here to Skip to main content
15,510,802 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,

I one error in web based programming to upload file on sever using javascript,html.Error is "http error 405.0 - method not allowed iis7(Windows Sever 2008R2)".

Mohibur Rashid 2-Apr-15 3:40am    
Have you tried google?
try this link
ZurdoDev 2-Apr-15 7:58am    
You need to provide the code you are using as well.
omgade 3-Apr-15 4:06am    
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' ''>
<html xmlns='' >
<title>AJAX Upload Progress & Cancel Upload</title>
<script type='text/javascript'>
var file;
function prepareUpload()
document.getElementById('fileSize').innerHTML = '';
document.getElementById('bytesUploaded').innerHTML = '';
document.getElementById('percentUploaded').innerHTML = '';
document.getElementById('uploadProgressBar').style.width = '0%';

// get file name
file = document.getElementById('file').value;
file = file.substr(file.lastIndexOf('\\')+1);
document.getElementById('fileName').innerHTML = file;

// get folder path
var curFolder = window.location.href;
curFolder = curFolder.substring(0, curFolder.lastIndexOf('/')+1);

document.getElementById('target').innerHTML = curFolder;
document.getElementById('frm').action = curFolder;

var timerId;
function formSubmit()
timerId = setInterval('updateProgress()', 1000);
document.getElementById('cancelUploadBtn').disabled = false;

function updateProgress()
var request = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
var uploadTarget = document.getElementById("frm").action + file;"REPORT", uploadTarget, true);
request.send("<upload-progress xmlns="ithit">");
var resp = request.responseText;

// Extract number of bytes uploaded and total content length of the file.
// Usually you will use XML DOM or regular expressions for this purposes
// but here for the sake of simplicity we will just extract using string methods.
var size;
var sizeIndex = resp.indexOf("total-content-length");
if(sizeIndex != -1)
size = resp.substring(resp.indexOf(">", sizeIndex)+1, resp.indexOf("", bytesIndex)+1, resp.indexOf("</iframe>";
document.getElementById("cancelUploadBtn").disabled = true;
<span id="uploadFrameHolder" style="display:none"><iframe name="uploadFrame" ></iframe></span>

<form id="frm" method="POST" enctype="multipart/form-data" action="/" target="uploadFrame" >
<input type="file" id="file" name="dummyname" /

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900