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

uploading file using javascript method on same page.

P: 273
Hi Guys

i'm trying to upload a file, i've tried 3 different methods but still not work out i don't know how to over come this problem

hidden file value, multiple form or popup uploading.


<SCRIPT TYPE="text/javascript">
function popupform(myform, windowname)
if (! window.focus)return true;'', windowname, 'height=200,width=400,scrollbars=yes');;
return true;

<!-- Action=upload.asp give you result back with file name which u uploaded. !-->
<FORM METHOD=POST ACTION="" onSubmit="popupform(this, 'join')">
<input type="file" name="fName" > <input type=submit value="Upload . ">

other method i'm using is


form within another form which is onchange method can upload inline frame by passing value for example.

<FORM ACTION="" method=post enctype="multipart/form-data" name="form">
<div id=ComboExample><p>Please click a button</p></div>
<input type="file" name="fName" value="" size="50" onchange="document.getElementById('ComboExample'). innerHTML='&lt;iframe src=&quot;upload.asp&quot; width=&quot;100%&quot; height=&quot;100&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;'">

3rd method i've tried is to passing textbox value as file path into file for example

<input type="hidden" value="c:\test.jpg" name=hid>
<input type="file" name="fName" value="document.formname.hid" style="display: none">

there is no problem by passing value into value but type as a file it's not take the value.

if any thing else that generate result on the same page by passing value please let me know

Jul 18 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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