|
Hello,
I am trying to upload files using CopyTo function of FileInfo.
The code I am using is as follows...
FileInfo fileObj = new FileInfo(filUpload1.PostedFile.FileName);
string fileType = filUpload1.PostedFile.ContentType;
string newFileName = "test.txt";
string folderPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Uploads");
fileObj.CopyTo(folderPath + "\\" + newFileName);
The exception I am getting is...
Could not find file 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\help.txt'.
Help.txt is the name of the file I selected using FileUpload control.
I could have used the SaveAs function of FileUpload control but I want to try it using above method. The files gets successfully uploaded when I do it on my machine but after uploading it on web server, it throws the above exception.
Please suggest.
Thank You.
|
|
|
|
|
Well Mr. Lucknow,
The reason behind this exception is that it is trying to find the file to be copied (in your case, it is help.txt) on the web server where it is not present.
In short, you can use this way to upload file to the web server.
|
|
|
|
|
<asp:linkbutton runat="server" id="btn_link" text="<%#Eval("p_link")%>" commandname="link" onclientclick="window.open('<%#Eval('p_link')%>');" xmlns:asp="#unknown"></asp:linkbutton>
please some one tell me why this is not work properly. can i do it or not. if not than how can i open this link in new window beacause its fill in ifrmae so open only in particular portion of the site.
thanks
I will do my best?
modified on Wednesday, August 13, 2008 8:38 AM
|
|
|
|
|
Please don't post HTML tags in your subject. It was being swallowed and thus no-one could look at your quesiton. Sorry, I didn't check to come up with a decent header.
What does 'not working properly' mean ? What is the HTML that is generated ? Is the #Eval not parsed properly ?
I am certain that as it's C# code, you can't use single quotes for the string you pass to Eval.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
thanks to reply.
yes this is c# code if i use in Eval single quote or in double quotes error is :
Error: missing ; before statement
Source File: http://localhost:1220/Adv/cate1.aspx
Line: 1, Column: 23
Source Code:
"window.open('<%#Eval("p_link")%;
how can i solve this problem
I will do my best?
|
|
|
|
|
hai,
currently i m using asp.net with c# (2.0 framework) and sql server 2000.
i finished my project and going to give the final link to my naive user (i have an intranet server with me). my link is like http://10.10.10.10:2001
Now my user need it as like his project, so that if the user enter his project name (say... MyProject) in the address bar of IE, then his project is to be open. (as like the internet link).
is there anyway to achieve it?
Thanks in advance.
KARAN
modified on Wednesday, August 13, 2008 8:07 AM
|
|
|
|
|
Buy a server space n upload ur project their.
Anand Desai
Developer
Atharva Infotech
|
|
|
|
|
I have an intranet server mwith me Mr.Anand Desai. i dont know how to implement it ? can u tel me?
|
|
|
|
|
This has nothing to do with programming.
What you need to is creating a mapping on Intranet DNS for this IP address to whatever name you like(let’s say My Project)
|
|
|
|
|
thanks a lot bhardway.. can u guide me how to map on intranet DNS for my ip address?.... plz....
|
|
|
|
|
I'm sure there are articles out there which will help you.
As has been said this is not a programming question, you are in the wrong forum. You may get more help posting in another forum.
|
|
|
|
|
in my project i need tomake a grid thrugh i can enter record to store
so i need to add new row at run time in grid view
so how too do it
Raghvendra
|
|
|
|
|
This is one way. This example adds an empty row in the gridview
Private Sub GridView1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.PreRender
Dim GV As GridView = CType(sender, GridView)
Dim Tbl As Table = CType(GV.Controls(0), Table)
Tbl.Controls.AddAt(index, AddEmptyRow)
End Sub
Function AddEmptyRow() As GridViewRow
Dim GVR As GridViewRow = New GridViewRow(0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Normal)
Dim cell As TableCell = New TableCell
cell.ColumnSpan = ColumnCount
cell.Text = " "
GVR.Cells.Add(cell)
Return GVR
End Function
|
|
|
|
|
Thanks for this code
but when i pasted this code at my page it gives error
Tbl.Controls.AddAt(0, AddEmptyRow)
Line gives error:
Specified argument was out of the range of valid values. Parameter name: index
Raghvendra
|
|
|
|
|
Exchange index for the rownumber you want to insert the new row at
|
|
|
|
|
I made a mistake in my code when i removed it it work properly
Thanks a lot
Raghvendra
|
|
|
|
|
Sir this code only help you in adding one row but when u want to add more row how to deal with
I mean
i added a row in which text box was there thrugh u can enter data but after filling it i want to add more rows to it
but i m not able to do it
Raghvendra
|
|
|
|
|
Where is your data coming from that prevents you from adding it the normal way via a dataset for example?
|
|
|
|
|
Sir in this data is not coming from anywhere but i m filling data thrugh this grig rows
Raghvendra
|
|
|
|
|
I'm not understanding what you're trying to achieve.
|
|
|
|
|
Sir i want to make r grid by which i can enter my records
so i need rows thrugh which i can enter Data (I need sotething like
sqlserver tabels in which when u want to fill data manually at adds another row to it the moment u start filling data in to rows
Raghvendra
|
|
|
|
|
Is it something like this[^] you mean?
Another method is here[^].
|
|
|
|
|
First of all thanks for cool lisining ,i mean since last i hour i m not able to tell u what i need even then u r lisining to me
Ok Sir this was not what i needed
i need a grid view control which will show me some rows at fost time i will open page lets suppose 3 rows ,
now i have 5 enteries to fill by these rows si first i will enter 3 record in 3 rows then i want to add 2 more rows so i can enter my rest of the records
for this suppose that i have a button addrows ,outside my grid
and i want ,the moment i click addrows button i would be able to add new rows thrugh it
so can u please guide me how to add more rows when i clicjk button
Raghvendra
|
|
|
|
|
You could of course experiment with the first code I sent to you, exchanging the line:
Dim GVR As GridViewRow = New GridViewRow(0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Insert)
But it's nothing I've tried.
I would keep it simple. Check out this one[^]
|
|
|
|
|
Check out this[^] one too.
|
|
|
|