473,387 Members | 3,684 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,387 software developers and data experts.

upload files

I want to upload files without file control.

suppose i have string "c:\test.txt"

i am using this

FileInfo Myfile= new System.IO.FileInfo("c:\test.txt");

string strBaseLocation = "c:\\amit\\";

objFile=(HttpPostedFile)Myfile; there is an error in this line cant
cast like this

objFile.SaveAs(strBaseLocation+Myfile.FullName);

please help me

Nov 17 '05 #1
7 1550
sonu,

Are you trying to copy the file on the local machine? Or to the c:\amit
directory on a web server (I don't know why you are using the HttpPostedFile
type).

If you want to upload a file to a website, you should use the UploadFile
method on the WebClient class. If you want to copy a file, then you want to
check the static Copy method on the File class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"sonu" <kr*******@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I want to upload files without file control.

suppose i have string "c:\test.txt"

i am using this

FileInfo Myfile= new System.IO.FileInfo("c:\test.txt");

string strBaseLocation = "c:\\amit\\";

objFile=(HttpPostedFile)Myfile; there is an error in this line cant
cast like this

objFile.SaveAs(strBaseLocation+Myfile.FullName);

please help me

Nov 17 '05 #2
I am tring to upload the file on webserver from client.
i want upload files from client to server with out using file control.
please give me link or sample of code about that.

Nov 17 '05 #3
sonu,

Check out the documentation for the UploadFiles method on the WebClient
class. It should give you an idea how to do this.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"sonu" <kr*******@yahoo.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I am tring to upload the file on webserver from client.
i want upload files from client to server with out using file control.
please give me link or sample of code about that.

Nov 17 '05 #4
Nicholas,

I tried and found this erroe

"The remote server returned an error: (405) Method Not Allowed."

what is the problem.

Nov 17 '05 #5
Sonu,

Files can be posted in a number of ways. You can issue a POST or a PUT.
Are you sure that the website that you are uploading to allows files
supports this?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"sonu" <kr*******@yahoo.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Nicholas,

I tried and found this erroe

"The remote server returned an error: (405) Method Not Allowed."

what is the problem.

Nov 17 '05 #6
Thanks Nicholas, for giving the valuable information

I Had to write the Reciever side code also for uploading the file.
i did that and find result.
Sonu

Nov 17 '05 #7
Nicholas i want to System property like java "System.Getproperty()"

Actualy i want to know the loged person name.

Any information?

Nov 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

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...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
4
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use...
0
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
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"...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
5
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
4
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
1
by: achotto | last post by:
hi, i try to upload a multiple image files. after that i will rename the files name. the problem is when i upload a 2 or more same files name exp-goal.jpg, it will return "files already exist". ok...
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: 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
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...
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
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.