Hello,
They need to upload huge files to ftp, because of the limitation of the plan,
I have partially written and copy code to make this work.
to use an external php fix this problem.
code snippet 1: jQuery/javascript:
<script>
$(document).ready(function(){
$('#IDFormField_fileupload_0').change(function(){
var file = this.files[0];
name = file.name;
size = file.size;
type = file.type;
//your validation
});
$('#IDFormField_fileupload_0').change(function(){
var formData = new FormData($('form')[0]);
$.ajax({
url: 'http://www.externalurl.com/5.php', //server script to process data
crossDomain: true,
type: 'POST',
xhr: function() { // custom xhr
var myXhr = $.ajaxSettings.xhr();
if(myXhr.upload){ // check if upload property exists
myXhr.upload.addEventListener('progress',progressHandlingFunction, false); // for handling the progress of the upload
}
return myXhr;
},
//Ajax events
success: function(data) {
if (data.successMessage){//
//set progress to 100%
$("body").find('progress').attr({value:100,max:100});
}
if (data.errorMessage){
console.log("error uploading file");
}
},
data: formData,
cache: false,
contentType: false,
processData: false
});
});
});
function progressHandlingFunction(e){
if(e.lengthComputable){
$('progress').attr({value:e.loaded,max:e.total});
}
}
</script>
code snippet number 2 php code:
[php]
[/php]
I have tested this outside of the his environment works perfectly.
when tested in his environment getting the following errors:
Failed to load resource: Origin http://www.website.com is not allowed by Access-Control-Allow-Origin. http://www.externalurl.com/5.php
XMLHttpRequest cannot load http://www.externalurl.com/5.php. Origin http://www.website.com is not allowed by Access-Control-Allow-Origin
Any suggestion. :-\