save file dialog window from a web page

R

rmunson8

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.
 
B

Bob Barrows [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top