473,378 Members | 1,389 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,378 software developers and data experts.

File Uploading

Hi all
am using asp.net 2.0, c#

i have a fileupload, hyperlink controls
i want to to upload hyperlink's navigate url
i wrote code as below

FileUpload1.PostedFile.FileName = HyperLink1.NavigateUrl;


but it is giving error as: Property or indexer 'System.Web.HttpPostedFile.FileName' cannot be assigned to -- it is read only

how to upload hyperlinks url

Please suggest

Thanks inadvance
Sep 8 '08 #1
6 2132
Curtis Rutland
3,256 Expert 2GB
This doesn't make sense to me at all. FileUpload is made for browser clients to upload files from their local machine, not for you to assign a web url to their uploaded file.
Sep 8 '08 #2
Frinavale
9,735 Expert Mod 8TB
You are not allowed to set the File Name property of a FileUploadControl. This is why you are getting the error you are seeing.

InsertAlias is correct at pointing out that this control is not designed to do what you are attempting.

Please provide more details on the problem you are attempting to solve so that we can point you to a control that can help you in your solution.

-Frinny
Sep 8 '08 #3
i want to send hyperlinks url as an attachment , for that am trying this
Sep 9 '08 #4
Curtis Rutland
3,256 Expert 2GB
You just want to send the hyperlink? As an email attachment? Hyperlinks aren't files, they are just text.

You could include the HTML for the correct link in the email.
Sep 9 '08 #5
You just want to send the hyperlink? As an email attachment? Hyperlinks aren't files, they are just text.

You could include the HTML for the correct link in the email.

i want to send the file as attachment
that file was nothing but hyperlinks url
i wrote as following
string fadd, toadd, s, att;
fadd = "";
toadd = "";
s = "";
att = "";
att = HyperLink1.NavigateUrl;

MailMessage M = new MailMessage();
M.To = toadd;
M.From = fadd;
M.Body = s.ToString();
M.Subject = "Profile";
attach = new MailAttachment(@att);
M.Attachments.Add(attach);
SmtpMail.Send(M);


fadd, toadd am retrieving from database

while executing this i got error as : invalied mail attachment

please check
Sep 9 '08 #6
Frinavale
9,735 Expert Mod 8TB
i want to send the file as attachment
that file was nothing but hyperlinks url
i wrote as following
string fadd, toadd, s, att;
fadd = "";
toadd = "";
s = "";
att = "";
att = HyperLink1.NavigateUrl;

MailMessage M = new MailMessage();
M.To = toadd;
M.From = fadd;
M.Body = s.ToString();
M.Subject = "Profile";
attach = new MailAttachment(@att);
M.Attachments.Add(attach);
SmtpMail.Send(M);


fadd, toadd am retrieving from database

while executing this i got error as : invalied mail attachment

please check
The reason you get this error is because you cannot attach a hyperlink to an email.......attachments to emails are files.

If you are developing an ASP.NET web application that sends an email with an attachment specified by the user you are going to have to place a FileUpload control on the page and write the code that uploads the file to the server. Please see this article for information on the FileUpload control and how to implement it.

Once the file is uploaded to the server you can attach it to your email.

If you just want to send an email with a hyperlink to a web page....then in your email body write the HTML that links to that web page...

Eg:
Expand|Select|Wrap|Line Numbers
  1. <a href="http://theUrlOfTheSite.com/">Text you want them to see in the email</a>
-Frinny
Sep 9 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: R. Rajesh Jeba Anbiah | last post by:
Q: How should I handle file upload? A: File uploading requires HTML form of content type "multipart/form-data". The file content has to be POSTed/submitted via the form and once the file is...
1
by: Jonathan | last post by:
Hi everyone, I have a problem with the file uploading in Asp.Net and I have read a lot on forums on this but never found an answer. Here is the problem: I know Asp.Net maximum Length for...
2
by: Daniel Reber | last post by:
I have an application that is sending a file to a location on a network. I have a windows service that is monitoring that location for new files and then processing them. Sometimes the service...
4
by: Shawn Mesiatowsky | last post by:
I have an html form that accepts a file for uploading, but I wanted to create a program to automate the upload procedure. I beileive you use the Webresponse class, but I was not sure how to use...
4
by: Kenneth Keeley | last post by:
Hi, I have a page that uploads files to my server and I wish to display a "Please wait while uploading" page to the user while the file is uploading. I have been able to redirect the user once the...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
3
by: Mike Kelly | last post by:
Hi. I've built a page using standard ASP.NET 2.0 features and when I upload a large file (>20MB) to our intranet server, I get a paltry 100KB/s on our 100Mb/s LAN. Simply copying the file, I get...
1
by: King | last post by:
Hello, I would like to check to see if the file that I am uploading to my server is of type CSV. I am currently doing that with the following snippet: HttpPostedFile file =...
3
ganesanji
by: ganesanji | last post by:
hi all, I have written a php coding for uploading a file to a specific folder or location in server which is a Linux server. I think the coding for file uploaing is correct. But it does not...
4
rahulephp
by: rahulephp | last post by:
i think i am missing something in the below script: It shows error an do not upload files to destination: Let me know how to solve this: <?php if (isset($_POST)) { $uploadArray=...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.