Click to See Complete Forum and Search --> : 1 Button file upload?


irr1449
12-07-2004, 11:27 AM
I am using upload.asp (found from a link on this forum) to do some file uploading. Is it possible to have 1 button that when pressed lanches the file selector dialog and then when that is done just posts the data? I don't real want to store the path on the page anywhere just have 1 button "Upload File".

lmf232s
12-07-2004, 12:22 PM
so once the file dialog box opens and you choose the file to upload,
and click open you just want it to be automatically uploaded?


Have you used hotmail or yahoo mail to upload files,
Is this how you want to do it or the first way?

irr1449
12-07-2004, 01:11 PM
The first way that you described. As soon as the user hits the ok button on the File Selection Dialog box it should upload the file. Not put the path in a textfield and then post that data.

lmf232s
12-07-2004, 02:11 PM
try this.

you have to have this.

<HEAD>
<script language=javascript>
function Upload(){
document.form.submit();
}
</script>
</HEAD>

<form method="post" ENCTYPE="multipart/form-data" id=form1 name=form1>
<input type="file" name="File 1" onchange="Upload();" style="width:0px;"></td>


What this does is set the width of the textbox to 0 so you dont
really see it(you see a light blue bar, very small, oh well) and that
way you only see the browse button.

Then we set the onchange property of the textbox so that after
we select a file and it populates the textbox it will call a function.
In this case its Uplaod() which basically submits the page the for the upload.

Now you should just be able to click the browse button, choose the file, click, open or ok and it will submit the page and upload the file.