Search:
Namespaces
Discussions
.NET v1.1
Feedback
Upload
Messages
Related Types
This message was discovered on
ASPFriends.com 'ngfx-io' list
.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Carlos Magalhaes
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2652.35">
<TITLE>Upload</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2>Hi all ,</FONT>
<BR><FONT SIZE=3D2>In the .Net SDK there is an example for uploading =
files now I cant seem to get that to work in the buttons click event =
here is the code:</FONT></P>
<P><FONT SIZE=3D2>Private Sub Browse_Click(ByVal sender As Object, =
ByVal e As System.EventArgs) Handles Browse.Click</FONT>
</P>
<BR>
<P><FONT SIZE=3D2> If =
Not IsNothing(Browse.PostedFile) Then ' HERE IT SAYS THAT POSTEDFILE IS =
NOT A MEMBER OF TXT BOX</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; Try</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; =
Browse.PostedFile.SaveAs(@"C:\SomeFolder\" + =
Path
.GetFileName(Browse.PostedFile.FileName)) ' HERE IT SAYS THAT =
POSTEDFILE IS NOT A MEMBER OF TXT BOX</FONT></P>
<P><FONT =
SIZE=3D2> &nb=
sp; Succ.text =3D "File uploaded successfully </FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; Catch Exc As Exception</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; Error4.txt =3D "Error saving file =
<br>" & Exc.ToString()</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; End Try</FONT>
<BR><FONT =
SIZE=3D2> End =
If</FONT>
</P>
<P><FONT SIZE=3D2>Now I need to run this in my current form (Form1) and =
I need this in code behind not in the HTML like the example in the SDK =
can anyone help me </FONT></P>
<P><FONT SIZE=3D2>Thank you </FONT>
</P>
<P><FONT SIZE=3D2>Carlos</FONT>
</P>
</BODY>
</HTML>
-------------------------------------------------------------
This email and any files transmitted are
confidential and intended solely for the
use of the individual or entity to which
they are addressed, whose privacy
should be respected. Any views or
opinions are solely those of the author
and do not necessarily represent those
of the Trencor Group, or any of its
representatives, unless specifically
stated.
Email transmission cannot be guaranteed
to be secure, error free or without virus
contamination. The sender therefore
accepts no liability for any errors or
omissions in the contents of this message,
nor for any virus infection that might result
from opening this message. Trencor is not
responsible in the event of any third party
interception of this email.
If you have received this email in error please notify
Click here to reveal e-mail address
For more information about
Trencor, visit www.trencor.net <http://www.trencor.net>
Reply to this message...
Mitch Denny (VIP)
Carlos,
The Browse object needs to be an instance of the
HtmlInputFile
control contained in the System.Web.UI.HtmlControls namespace,
assuming you want to pull the posted file from the control
directly. A quick sample on how to do this is in the SDK at
this location:
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfsystemwebuihtmlcontrolshtmli
nputfileclasspostedfiletopic.htm
There is another way to do it, which is by pulling the
files collection on the request object, here is a sample
in the SDK on how to do that:
ms-help://MS.VSCC/MS.MSDNVS/cpref/html/frlrfSystemWebHttpRequestClassFil
esTopic.htm
My suggestion would be to use the first method because
if you have multiple file inputs on a form it make it
easier to figure out which one is which. Use the above
examples as your template and then work from them to
get it working for your specific scenario, the first
one is exactly what you want to do I think.
----------------------------------------
- Mitch Denny
-
Click here to reveal e-mail address
- +61 (414) 610-141
-
-----Original Message-----
From: Carlos Magalhaes [mailto:
Click here to reveal e-mail address
]
Sent: Thursday, 23 May 2002 03:41
To: ngfx-io
Cc:
Click here to reveal e-mail address
Subject: [ngfx-io] Upload
Hi all ,
In the .Net SDK there is an example for uploading files now I cant seem
to get that to work in the buttons click event here is the code:
Private Sub Browse_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Browse.Click
If Not IsNothing(Browse.PostedFile) Then ' HERE IT SAYS THAT
POSTEDFILE IS NOT A MEMBER OF TXT BOX
Try
Browse.PostedFile.SaveAs(@"C:\SomeFolder\" +
Path
.GetFileName(Browse.PostedFile.FileName)) ' HERE IT SAYS THAT
POSTEDFILE IS NOT A MEMBER OF TXT BOX
Succ.text = "File uploaded successfully
Catch Exc As Exception
Error4.txt = "Error saving file <br>" & Exc.ToString()
End Try
End If
Now I need to run this in my current form (Form1) and I need this in
code behind not in the HTML like the example in the SDK can anyone help
me
Thank you
Carlos
| [ngfx-io] member
Click here to reveal e-mail address
= YOUR ID |
http://www.aspfriends.com/aspfriends/ngfx-io.asp
= JOIN/QUIT
------------------------------------------------------------- This email
and any files transmitted are confidential and intended solely for the
use of the individual or entity to which they are addressed, whose
privacy should be respected. Any views or opinions are solely those of
the author and do not necessarily represent those of the Trencor Group,
or any of its representatives, unless specifically stated. Email
transmission cannot be guaranteed to be secure, error free or without
virus contamination. The sender therefore accepts no liability for any
errors or omissions in the contents of this message, nor for any virus
infection that might result from opening this message. Trencor is not
responsible in the event of any third party interception of this email.
If you have received this email in error please notify
Click here to reveal e-mail address
For more information about Trencor, visit
www.trencor.net
Reply to this message...
System.EventArgs
System.IO.Path
System.Web.UI.HtmlControls.HtmlInputFile
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com