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

how to upload and save an file from app_data in asp.net

i want solution for this friends.
In my application am using c#.net with out using database. this am doing for intranet ,my query is:
I have created a folder called " backup " in app_data ..in my application,in that folder am uploading files using file-upload..according to the needs..now i want to display those files in data grid with link button or only link button..if i click that link button the file should save in my file system like save as...what are the files in backup folder should be displayed as links...step by step..
any one please help me in this...

just for example..in app_data i have backup folder...in that folder i have 3 files for example...call as a.txt,b.txt.c.txt...these files should display in my page ...the file is not necessary to open ...i just want to show all files in page. if i click any file it should be saved in file system...

for uploading i used this code
Expand|Select|Wrap|Line Numbers
  1. protected void Btnoffline_Click(object sender, EventArgs e)
  2.     {
  3.         if (Flpload.PostedFile.FileName == "")
  4.         {
  5.             lblstatus.Text = "No file specified.";
  6.         }
  7.         else
  8.         {
  9.             try
  10.             {
  11.                 string serverFileName = Path.GetFileName(Flpload.PostedFile.FileName);
  12.  
  13.                 Flpload.PostedFile.SaveAs(MapPath("~/App_Data/backup/") + serverFileName);
  14.                 lblstatus.Text = "File " + serverFileName;
  15.                 lblstatus.Text += " backup  file uploaded successfully.";
  16.             }
  17.             catch (Exception err)
  18.             {
  19.                 lblstatus.Text = err.Message;
  20.             }
  21.  
  22.         }
  23.     }
  24.  
now here upload of backup file is over ...so this process will continue daily...now next issue is that to see those uploaded files some where in any control or page...and if click those files it should save some where..
if u have good any good idea resolving this ..plz share to me...i will develop like that..
thanks
kalyan
Jan 24 '12 #1
1 4608
PsychoCoder
465 Expert Mod 256MB
Dont upload to App_Data, it's not a usable folder, it's for data only so you will not be able to view anything there on the web.
Jan 26 '12 #2

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

Similar topics

5
by: Grace | last post by:
Hello, I want to upload the file by webpage to SQL Server. When I upload the small file, it is work. But, when I upload big file(ex. 40~50 MB), it isn't work; the Browser displays the...
14
by: Al Smith | last post by:
I need help in implementing proper error handling. I am trying to upload a file based on the sample code below. The code works well except if the file selected is too big. I do know about the...
3
by: Sarav | last post by:
Hi All, I need to upload an XML file via an client side ActiveX control. I searched the web but everywhere got the samples of using file control alone. How can I upload a file into my web server...
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
4
by: Jonny | last post by:
Hello Group How do I open a Save File Dialog from an ASPX page behind a browse button? Any help would be fantastic!! I am using ASP.NET 1.1 using VB.NET as the coding language TIA
0
by: aris1234 | last post by:
hello.. How to upload image file in page update ..?? i have logic like this : if user upload new image then old image must delete and update DB used new name if user not upload new image then...
2
by: rinkudhimar | last post by:
I want to write using fwrite and upload the file without using File Field or Browse option. Actually I want to upload static file after writing it useing fwrite and as soon as it gets uploaded it...
2
by: simonyong | last post by:
Hello, anyone I had search for few days with how to save file when user choose a file name from listbox and i will search the file from database and user can save it into their desktop what I had...
3
by: vijaykumardahiya | last post by:
Hello To Every One, I want to know that when I upload the File like a image from html page Its not show on servlet page using appropriate logic. I read the FileUpload Home page.But I am still...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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...

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.