473,406 Members | 2,549 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,406 software developers and data experts.

<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(HttpPostedFile uploadedFile)
{
FileInfo uploadedFileInfo = new FileInfo(uploadedFile.FileName);
......
uploadedFileInfo.CopyTo(fileName, true); // fails on server but not on local host
}
and then later
public void SendEmail(string sendTo, string fileName, string subject, string eMessage)
{
......
MailAttachment ma = new MailAttachment(fileName,MailEncoding.Base64);
}

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

"SibAndela" <Si*******@discussions.microsoft.com> ¦b¶l¥ó
news:38**********************************@microsof t.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(HttpPostedFile uploadedFile)
{
FileInfo uploadedFileInfo = new FileInfo(uploadedFile.FileName);
.....
uploadedFileInfo.CopyTo(fileName, true); // fails on server but not on local host }
and then later
public void SendEmail(string sendTo, string fileName, string subject, string eMessage) {
.....
MailAttachment ma = new MailAttachment(fileName,MailEncoding.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
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...
1
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"...
1
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...
4
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...
7
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...
2
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");...
7
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...
3
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...
1
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...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
0
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,...

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.