471,852 Members | 1,175 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,852 software developers and data experts.

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

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
1 18334
acoder
16,027 Expert Mod 8TB
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.

Similar topics

1 post views Thread by Jarrod | last post: by
1 post views Thread by Jesper Hermansen | last post: by
7 posts views Thread by Tim Slattery | last post: by
NeoPa
reply views Thread by NeoPa | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.