rmunson8 said:
What is the appropriate control or code to pop a "save as" dialog
window to allow the user of a web page to save a document after they
click on a link? All of the CommonDialog controls obviously are to be
used on WinForms, so not sure how to accomplish this from an aspx
page.
There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.
Here is an aspx page html that allows the client's file system to be
browsed:
<form id="Form1" encType="multipart/form-data" runat="server">
<INPUT id="uploadedFile" type="file" name="uploadedFile"
runat="server">
<INPUT id="upload" type="button" value="Attach" name="upload"
runat="server" OnServerClick="Upload_Click">
</form>
Here is the server-side code that handles the posted file:
Sub Upload_Click(ByVal source As Object, _
ByVal e As EventArgs)
If Not (uploadedFile.PostedFile Is Nothing) Then
Try
Dim savePath As String = _
Server.MapPath("SavedFiles") & "\"
Dim postedFile As HttpPostedFile = _
uploadedFile.PostedFile
Dim filename As String = _
Path.GetFileName(postedFile.FileName)
postedFile.SaveAs(savePath & filename)
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
End If
End Sub
cp'ed and followup-to set to aspnet
HTH,
Bob Barrows