0

I have been trying to use a basic portion of JavaScript code to upload files on a HTML website, however I am having some difficulty. The filepath for some security reasons is getting blocked by browsers, and returning "C://fakepath". The below code is from me just checking why I cannot find the files I select.

<script language="JavaScript">
function showname(){
    var  file = document.form1.uploadBox.value ;
    document.form1.filename.value = file ;
}
</script>
<form name="form1">
Click on browse to choose a file to send.
Click on the Send button to see the full path for the file sent.
File to send: <input type="file" name="uploadBox">
<input type="button" value="Send" name="get" onClick='showname()'>
<input type="text" name="filename" size="40">
<input type="submit" value="Upload File"  >

I am wondering if there is a way to collect a file from a local machine without requesting the entire filepath? I see websites allowing its users to upload files everyday, how do they achieve this? and should I be using another language?

If someone could please explain this to me I would be very grateful.

0 Answers0