By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,336 Members | 1,048 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,336 IT Pros & Developers. It's quick & easy.

How to set the path value to <input type="file"> object

P: 2
Hi All,

How to set the path value to file object using javascript. now i am trying to upload the file without using browse button, but i could not set the path value..

see my code:

<form name="thisForm" enctype="multipart/form-data">
<table align="center">
<tr>
<td align="left"><b>Select a file to upload :</b></td>
</tr>
<tr>
<td align="left">
<input type="file" id="filename" name="uploadfile" size="50">
</td>
</tr>
<tr>
<td align="left">
<input type="button" name="button" value="Upload" onClick="fnupload()">
</td>
</tr>
</table>
</form>

// not reflecting
document.thisForm.uploadfile.value="C:\Documents and Settings\test.txt";
document.thisForm.action="UploadFile.jsp"
document.thisForm.method="post";
document.thisForm.submit();

Thanks
Kalaivani
May 25 '07 #1
Share this Question
Share on Google+
1 Reply

acoder
Expert Mod 15k+
P: 16,027
This is not supported and a good job too otherwise it would be a security hole. Imagine if someone programs a website to upload any file from your local drive onto his server.

See this page.
May 25 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.