As file to add in input file?

Do I need a person could select a file on the server or upload your. Now I have implemented the selection of the file to a PC user like so:
<input type="file" id="fileselect" onchange="middleware_prepare_upload_file();">

$id('fileselect').click();

the <script>
middleware_prepare_upload_file function(){
if ($id('fileselect').value == ")
return;

 UploadModelData = $id('fileselect').files[0]

upload_file($id('fileselect').files[0]);
}

function upload_file(f)
{
 if (waiting) return;

 if (!supported_file_type(f.name))
{
 alert('File type is not supported');
 return false;
}


 if (f.size>max_file_size)
{
 alert('File is too big maximum allowed size is 20mb');
 return false;
 } 

read_file(f);
}



function read_file(f)
{
waiting=true;

 var pbar=$id('file_pbar');
 var reader = new FileReader();

 reader.onerror = function(e)
{
 var error_str="";
switch(e.target.error.code)
{
 case e.target.error.NOT_FOUND_ERR:
 error_str="File not found";
break;

 case e.target.error.NOT_READABLE_ERR:
 error_str="Can't read file - too large?";
break;

 case e.target.error.ABORT_ERR:
 error_str="Read operation aborted";
 break; 

 case e.target.error.SECURITY_ERR:
 error_str="File is locked";
break;

 case e.target.error.ENCODING_ERR:
 error_str="File too large";

break;

default:
 error_str="Error reading file";
}
alert(error_str);
switch_view('drag');
 return after_error();
 } 

 reader.onload = function(e)
{
switch_view('proc');
 setTimeout(function(){after_file_load(f.the name, e.target.result)}, 500);
};

 reader.onprogress = function(e)
{
 if (cancel_download)
{
reader.abort();
 return after_error();
}
 else 
 pbar.value=e.loaded / e.total*100;
 }; 

pbar.value=0;

switch_view('pbar');

reader.readAsArrayBuffer(f);
}

</script>


As in input file add file on a known url?
July 2nd 19 at 13:35
1 answer
July 2nd 19 at 13:37
Solution
> In input file add file on a known url?
Any way, for the security policy of the browser.
and I do not know why so do? - Jeanette_Zboncak14 commented on July 2nd 19 at 13:40
: Well, you imagine that "it" allowed to do? It as will be just to read all the user files and send them to hackers. ))) - ima.Halvorson commented on July 2nd 19 at 13:43
: Pile up, for example, is prohibited by the machine to obtain coordinates of the user through the browser. For the same reasons. This is private information. - ima.Halvorson commented on July 2nd 19 at 13:46
: I you mail written. Please read. - Jeanette_Zboncak14 commented on July 2nd 19 at 13:49

Find more questions by tags JavaScript