Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript msgbox server side using response.write

Status
Not open for further replies.

markdt

Technical User
Feb 15, 2006
63
GB
Hi All,

I have a problem.

I have been tasked to produce a upload page, this all works great but i wanted some validation and msgbox popups.

Basically if a file already exists i want the user to be prompted "File blahblah already exists do you want to overwrite it?" And a simple yes no box.

The checking for file existence is done within the loop of uploading files on the server side. It then writes a message box to the client.

' Loop through the uploaded files
For Each File In Uploader.Files.Items
FileCount=FileCount + 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strDirectory & File.FileName) then

Response.Write "<script language=""vbscript"">MsgRet = MsgBox ("" File " & File.FileName & " already exists, would you like to overwrite it?"", vbQuestion + vbYesNo + vbDefaultButton1,"" WARNING"")"&CHR(10)&"Document.Write(MsgRet)"
Response.Write "" & CHR(10) & "</script>"

' Save the file
File.SaveToDisk strDirectory
' Output the file details to the browser
'Response.Write(MsgRet)
Response.Write "<b>Thank you for your upload </b><br>"
Response.Write "File Uploaded: " & File.FileName & "<br>"
Response.Write "Size: " & File.FileSize & " bytes<br>"
Response.Write "Type: " & File.ContentType & "<br><br>"

End If
Next

I cant seem to access MsgRet variable from my server side run script, although i can use document.write(MsgRet) to display it on the page.

Please help

Mark
 
serverside is serverside and clientside is clientside and the two only meet if you write some javascript to call an ASP function that returns a value BEFORE you submit the file.

It's known as AJAX

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top