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

File Upload

how do i upload a file from a default location in the client machine in asp.net using c# ?.To be made more clear, instead of using the browse button, when i click the upload button the file in a particular location must be automatically uploaded.
Please reply to me as early as possible....
Mar 29 '08 #1
6 988
Hi
keep this code in button
may be this is useful of u

Expand|Select|Wrap|Line Numbers
  1. if (FileUpload1 .HasFile)
  2.         {
  3.  
  4.             FileUpload1.SaveAs("C:/Documents and Settings//Desktop/sample/"+ FileUpload1.FileName.ToString());
  5.             Label1.Text = "File Uploaded: " + FileUpload1.FileName;
  6.         }
  7.         else
  8.         {
  9.             Label1.Text = "No File Uploaded.";
  10.         }
Mar 29 '08 #2
Thank you for your reply.But,should i use the file upload component here?
Mar 29 '08 #3
balabaster
797 Expert 512MB
Where are you uploading to? A web server, ftp server? Can you give us some more detail on what you are trying to achieve?
Mar 29 '08 #4
Frinavale
9,735 Expert Mod 8TB
Thank you for your reply.But,should i use the file upload component here?
You should be using the FileUpload control if you are uploading files from the client's computer to the web server in an ASP.NET web application (ie. if you are uploading files through a web browser).

Take a look a the FileUpload Control for more information on how to upload files and code examples in both C# and VB.NET.

-Frinny
Mar 29 '08 #5
Thank you all for your response.
I can make my question more clear.
I am coding for a program in which i need to capture data from a text file(default location.there should not be any need for the user to use browse button).When the user clicks the button the data in the text file should be automatically broght to a text box.(the text file may contain not more than 2 or 3 digits)
Mar 31 '08 #6
Hello!

As I can see you are trying to get an acess to file system on the client's machine. It is cannot be done with standart html elements or javascript(security model).

FileUpload control is rendered on client side to
Expand|Select|Wrap|Line Numbers
  1. <input type=file name=file1>
, so it's the same standart html.

So, you can use some activex or java applet for solving your task.
May 13 '08 #7

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

Similar topics

4
by: Tihon | last post by:
Hello! I again need your help, just can't understand whats going on. Got this upload pictures form and it's having problem handling large files (~1.5 - 2 MB). Everything works fine if i just...
15
by: Simon | last post by:
I would like to create a very basic file upload add image form to add to my web site and to keep them in a "tmp" directory within my web hosting file manager once uploaded. I understand the basic...
2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
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...
2
by: mark | last post by:
How do I detect that a particular form element is a file upload or if the file upload has worked? In the Python cgi module documentation I found suggested code... form = cgi.FieldStorage()...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
2
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
1
by: chrisj | last post by:
I'm using freeASPupload and got some assistance integrating to a Member script. It works successfully. In this modified version there are two groups that use this upload script. Members of one...
6
Jacotheron
by: Jacotheron | last post by:
I need a PHP script that can upload music files (mp3). The script is for a home project I have started a while ago. I have a MySQL database of all the music that I have. Other computers on the...
7
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.