473,659 Members | 3,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<INPUT type="file" runat="server" - attach to email

Is there a way that I can attach the uploaded file from a client web site to the web server without first storing the uploaded file on the server?

Currently on my local PC (local host) the following code works but not when I run the app from a web server it fails:

private void StoreFile(HttpP ostedFile uploadedFile)
{
FileInfo uploadedFileInf o = new FileInfo(upload edFile.FileName );
......
uploadedFileInf o.CopyTo(fileNa me, true); // fails on server but not on local host
}
and then later
public void SendEmail(strin g sendTo, string fileName, string subject, string eMessage)
{
......
MailAttachment ma = new MailAttachment( fileName,MailEn coding.Base64);
}

The upload fails every time
Nov 18 '05 #1
1 2538
I think you have to enable "write" right for ASPNET(or other impersonation
account you used) account on the server first for HtmlInputFile.C opyTo() to
work.

"SibAndela" <Si*******@disc ussions.microso ft.com> ¦b¶l¥ó
news:38******** *************** ***********@mic rosoft.com ¤¤¼¶¼g...
Is there a way that I can attach the uploaded file from a client web site to the web server without first storing the uploaded file on the server?
Currently on my local PC (local host) the following code works but not when I run the app from a web server it fails:
private void StoreFile(HttpP ostedFile uploadedFile)
{
FileInfo uploadedFileInf o = new FileInfo(upload edFile.FileName );
.....
uploadedFileInf o.CopyTo(fileNa me, true); // fails on server but not on local host }
and then later
public void SendEmail(strin g sendTo, string fileName, string subject, string eMessage) {
.....
MailAttachment ma = new MailAttachment( fileName,MailEn coding.Base64);
}

The upload fails every time

Nov 18 '05 #2

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

Similar topics

1
7528
by: Jarrod | last post by:
Just reading from a previous thread about multiple uploads. I wanted to use script to create multiple input file elements that put the path in as a default (or something like that) based on ASP code. My problem was that the input file value property is readonly and there is no default value. The thing is you can cut and paste a path manually (ctrl-c,v) but I couldn't work out how to do it from code. I thought that anything that you...
1
2778
by: Pai | last post by:
Hello there, Good Morning, I am facing a peculiar problem. I have the following code in the html section of my .apsx page <input type="file" runat="server" id="fileBrowse" NAME="fileBrowse">
1
3290
by: Mark Sandfox | last post by:
Is there a way to restrict the user to only selecting and sending either a ..gif or .jpg. Everything I have read says this option can not be done by design (security reasons). I find that irronic as this is the reason (security) that I want to restrict their selection. Any help on this one will be greatly appreciated. The page is using ASP.NET.
4
2712
by: Don Wash | last post by:
Hi All! I'm getting the following Error: No DLLs has been compiled yet and nothing in the \bin directory. So it is not the versioning problem or anything like that. And here are the source of the files...
7
2653
by: Drew Berkemeyer | last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make of it. I have a web service that consumes an XML file as well as a few other parameters. This web service works fine if I use the web test interface. It also works fine if I call it from an ASP.NET page that has a text box where the XML is pasted and then passed on. However, I get an exception if I use an <input type="file"> control on the ASP page that allows...
2
2887
by: trint | last post by:
With the following code, I get the "message" whether or not there is content in my filefield: function check_file_field() { var file_field = document.getElementById("custCartFile"); if(file_field.value.length == 0) { alert("You are required to select an Image"); return false;
7
20859
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box is clicked, or "Enter" is hit in the attached text box. I can get the value of the element. But in Netscape 7, onChange doesn't fire until focus leaves the element. When you double-click a file name or click "open" in the Open box, the...
3
10385
by: Gert | last post by:
Would it be possible to access the file CONTENT in codebehind for a standard: <input id="htmlFile" type="file" /> Then in codebehind: foreach (string keyName in System.Web.HttpContext.Current.Request.Form.Keys) { //i can see keyName = "htmlFile" here as well as the "c:/myfile.txt" for example
1
3300
by: sandeep kumar shah | last post by:
Hi, We have used a file uploading HTML tag in an HTML page. We need to customize the text displayed on the Button (which is by default “Browse…” for internet explorer). Below is the code we have used: CODE: <input type="file" style=" width:100%" id="importFile" name="importFile"/> As per our analysis we got two methods but none is satisfactory. Please let us know if there is any other way out
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.