By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,369 Members | 1,188 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,369 IT Pros & Developers. It's quick & easy.

save file dialog window from a web page

P: n/a
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.
Sep 10 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
From ASPFAQ

http://mosley.arach.net.au/dev/docs/save%20as.htm

"rmunson8" <rm******@discussions.microsoft.com> wrote in message
news:35**********************************@microsof t.com...
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.

Sep 11 '05 #2

P: n/a
rmunson8 wrote:
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
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Sep 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.