Click to See Complete Forum and Search --> : ASP Upload issue.
dthurman1432
06-12-2006, 12:21 PM
Has anyone worked with the Free ASP Uploader from freeaspupload.net ?
I currently have a link from a form that does a javascript popup to open the upload page. What I would like to do is after the user clicks on "upload file" and the file is uploaded to a folder on my server, the popup automatically closes and sends the value of the file to my form.
If your not sure what I'm talking about does anyone have a solution to my problem through other means other than the free asp uploader?
Terrorke
06-13-2006, 03:14 AM
Does the upload work?
I have used it ones and it worked perfect.
But I assume that the problem isn't in your uploader itself?
dthurman1432
06-13-2006, 10:02 AM
If you have already guessed this is the value of my popup window from the previous thread. The upload works great but after it uploads the popup window sits there with the value of the file it uploaded. I have to require the end user to copy and paste the file value back to the form for later lookup. I need the popup to auto close or at least have the value auto populate my original form.
lmf232s
06-13-2006, 01:37 PM
dthurman,
you can do 1 of 2 things here (maybe more but im only give you 2 :))
Play around w/ those and let me know if you have any problems.
1. After the upload code on your popup window you could add this code. This will just reload the calling page which might not be what you want. The idea is that you have a query on the main page to pull in the uploaded files.
Response.Write "<script language=javascript>"
Response.Write "window.opener.reload();"
Response.Write "window.close();"
Response.Write "</script>"
2. There are 2 ways in which you can get the file uploaded (string value) back to the opener window.
instead of the window.opener.reload(); you could use
window.opener.document.form1.txtFielName.value = 'The file you uploaded'
or you could just call a function on the opener document and execute the code on the main page.
function on main page
function Expand(FileName, FilePath, nid){
document.form1.txtFileName = FileName;
return false;
}
code on the popup form
In one of my upload forms i set a boolean variable after the upload is finished and sucessfull. At the bottom of the page i have this code which calls the function on the main page and passes in the values.
<%
If bValid = True then
%>
<script language=javascript>
opener.Expand("<%=MyFileName%>", "<%=MyFilePath%>", <%=KEYID%>);
</script>
<%
end if
%>