TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Raghvendr Singh
NA
117
127.8k
File upload/download
Jan 12 2011 1:51 AM
I have written code for file upload / download .It is working fine but when using download manager(DAP) then instead of file ,.aspx file is being download itself.
please suggest me.
For uploading I used code as:
//fupload is asp:FileUpload control
fupload.SaveAs(Server.MapPath(
"./Image1/Image1/"
+fupload.FileName));
and for downloading :
//
fName is string that holds file name for downloading
System.IO.
FileInfo
fileToDownload =
new
System.IO.
FileInfo
(Server.MapPath(
"Image1/Image1/"+fName
));
if
(fileToDownload.Exists)
{
Response.Clear();
Response.AddHeader(
"Content-Disposition"
,
"attachment; filename="
+ fileToDownload.Name);
//Response.AddHeader("Content-Length", fileToDownload.Length.ToString());
Response.ContentType =
"application/OCTET-STREAM"
;
//Response.Flush();
Response.WriteFile(fileToDownload.FullName);
Response.End();
}
Reply
Answers (
1
)
How to use the dlls
how to create chat application in asp.net