$('.upload').change(function () {
var $container = $('#container');
$container.find('input:checkbox, input:text, select').val('');
var $thisUpload = $(this);
var path = 'file:///' + $thisUpload.val().replace(/\\/g, "/");
$.ajax({
url: path,
dataType: 'xml',
success: function (data) {
},
error: function (request, status, error) {
if (error.message == 'Permission denied') {
//this is where i end up
}
}
});
});
I know that a "blocked" file can cause this error in IE:
However, this file is not blocked. And it is located next to my .html file containing the code above.
What could possibly cause the "permission denied". I highly doubt this is due to the same origin policy.
Any help is MUCH appreciated. Thanks
Edit: This only occurs on my windows xp computer using ie7. Ie7-mode in win7 works well.
Edit #2: This only occurs for xml files which are downloaded as mail attachments.
It sounds like you are facing the same issue as this existing post jQuery AJAX problem in IE7 (possibly other versions as well) , in which it was solved by writing the code to make the ajax call without using jQuery (created XMLHttpObject, onreadystatechange, etc) and using jQuery to parse the XML.
You can't access local files like that through AJAX for obvious security reasons.
Note that the file:///
protocol points to the local file system of the client machine that is executing the code.
If the file is on your server, you should be able to revise your path so as to point to the server location.
You say that this only occurs for xml files which are downloaded as mail attachments and only on win xp. Maybe some antivirus app or your e-mail client blocks xml attachments, do you download attachments via WWW client or some desktop client ?
just remove file:/// and give the path itself. It means give path/filename.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With