473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

PostedFile.SaveAs going to browse window automatically ???

some confusion here.

The below code allows me to save a local file to my web server and
somehow because the field type is file a local file browse button is
rendered. I'm trying to figure out how to incorporate this code into
an existing asp.net (vb).

In my code "C:\Uploads\uploadedfile.txt" is dynamcially set to a value
pulled from a textbox, but how do automatically get browse window to
come up when I call a subroutine asp.net. Does asp.net have an
asp:file tag type? I'm looking to always select the local file via a
browse window, and don't want a local file field to be visible.

Thanks in advance!

<%@ Page Language="VB" %>
<script runat="server">

Sub SubmitButton_Click(Source As Object, e As EventArgs)
If Not (File1.PostedFile Is Nothing) Then
Try
File1.PostedFile.SaveAs("C:\Uploads\uploadedfile.t xt")
Span1.InnerHtml = "Upload Successful!"
Catch ex As Exception
Span1.InnerHtml = "Error saving file <b>C:\\" & _
File1.Value & "</b><br>" & ex.ToString()
End Try
End If
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server" enctype="multipart/form-data">
Select a file to upload:<br />
<input type="file" id="File1" runat="Server">
<p>
<input type="submit" id="Submit1" runat="Server"
value="Upload File" OnServerClick="SubmitButton_Click">
<p>
<span id="Span1" runat="Server" />
</form>
</body>
</html>
Nov 18 '05 #1
0 1456

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tobias Oberascher | last post by:
Good Morning, everybody! I've encountered big problems with one of my file-fields, which was implemented for uploading files. Some of my users don't have any problems at all - the...
0
by: Alex Pet | last post by:
Hi, I have a very strange situation here. I have an aspx page through which I upoload image file in a folder. I can upload file first time successfully. when second time I try to upload same...
1
by: Sileesh | last post by:
Hi I have a Button in an .aspx page. On server click of this button, I perform some Operation. Now my question is, is there any way that i can close this window automatically after the...
4
by: Sileesh | last post by:
Hi I have a btn in Parent.aspx page . On server_click() of the Btn, i am opening a new window called the child.apsx window. Child window also have a Btn. On serverClick of this Btn, I perform...
0
by: phl | last post by:
hello, I have an input control which saves a file user specifies. Like this : SaveCon.PostedFile.SaveAs(sDocPath) This cause a postback which presents a problem as I want this to happen in my...
1
by: Hadar | last post by:
Hi, I'm trying to upload files and to use the revision number field of the file. By using PostedFile.SaveAs the files are uploaded. The problem is that the summary tab and the revision number...
1
by: Nico Grubert | last post by:
Dear Python developers, I use a short python script in order to run an external application plus to open a browser displaying a default page. My Setup: Python 2.4.3. / Windows2000 #...
3
by: rsaikamesh | last post by:
Hi, I am using gtkmm 2.4 to create UI in my c++ application.My operating system is linux(ubuntu).I have barcode scanner which is connected to the serial port(/dev/ttyS0). What I have to do in my...
1
by: daokfella | last post by:
I have a web usercontrol on which is a Webcontrols.FileUpload control. I expose the PostedFile property as a readonly property of the usercontrol. That way, a page has access to it. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.