|
I tried to run on localhost on my computer it work fine but it didn't work on my server.
I'm not sure how to coding for proper path on the server please see.
FileUpload.PostedFile.SaveAs(Server.MapPath("TextFiles//mydata.txt"));
//Is this right?
If I have my webhost like this ftp://webhost.example.com/... <-- and I put all file and folder here.
And i'm sure I the TextFiles folder is existed.
Thank you million sir,
junior boy
|
|
|
|
|
OK Can't you access that and see folder exist or not ..........
Ok you can do one thing before uploading a file First check the Directory TextFiles exist or not if it not present there create with same name and put your file in that directory What you think my friend ?;)
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
The standard way of doing this would be to do the following:
if (!Directory.Exists(Server.MapPath("/TextFiles")))
Directory.Create(Server.MapPath("/TextFiles")); Then, you can do the save as operation. Note that the asp worker process will need permissions to write into your directory structure to do this.
|
|
|
|
|
I am really appreciated all your help sir.
I don't get it work yet but I am trying.
Thank you for all replied message again sir,
junior boy
|
|
|
|
|
I have been trying to upload all last night
please see this code:
================================================================================
string fileName = Server.MapPath("~/471463016/TextFiles/");
if(Directory.Exists(fileName))
Response.Write("Existed");
else
{
Directory.CreateDirectory(fileName);
Response.Write("Not Exist");
}
================================================================================
It shows me message: Existed
And then please see code:
================================================================================
Response.Write("Path = "+fileName);
try {
FileUpload.PostedFile.SaveAs(fileName+"mydata.txt");
}
catch(Execption ex){
Response.Write(" Error: " + ex.Message);
}
================================================================================
The result :
Path = D:\webhost\471463016\TextFiles\
Error: Access to the path 'D:\webhost\471463016\TextFiles\mydata.txt' is denied.
I don't really understand why I have the error when it show me the folder path is existed.
Believe me, I have been try so hard as i have never tried, I really need help because
I have deadline on July 7 Saturday to send my school project,sir.
Again, anyhelp will be really appreciated.
My email : big_kh@hotmail.com
Thank you million,
junior boy
|
|
|
|
|
Check your permissions. ASP.NET applications run under a special worker process and this process will need permissions to write to the file system.
|
|
|
|
|
|
Hi! Anybody knows how to pass the string from *.aspx to the formula in crystal report X.rpt?
I have more than one formula in my X.rpt. how do i point a specific formula at X.rpt?
eg. I have string "strName"
I need it to be passed to the crystal report X.rpt programatically using c#.
Thanks.
Rgds,
|
|
|
|
|
Since you are new, please read the forum guidelines. Highlights include:
1. Do not include words like 'urgent' or 'help' in your message titles.
2. Do not use text speak.
______________________
stuff + cats = awesome
|
|
|
|
|
Hello..
Is there any way to create the dsn in vb.net programically.
This is required in cyatal reports.as crystal reports can not run on clients machines which have hard drive path.
|
|
|
|
|
hai everybody
iwant to insert latitude value(means ex:23*34'23" this * is superscript).now i want to replace degree(0) with *.plz help me.
|
|
|
|
|
Look up string.Replace on msdn:
http://msdn2.microsoft.com/en-us/library/fk49wtc1.aspx
Hope this helps
Dan
|
|
|
|
|
Using hyper link how to pass one value from one aspx page tp anothat aspx page?,
Regards,
Magi
|
|
|
|
|
Use querystring for that purpose.
Apurva Kaushal
|
|
|
|
|
QuerySrtring will help you HyperLink1.NavigateUrl = "SomePage.aspx?Key=" + valueTObePasses + "$NextKey=" + SecondVlaue;
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
hi Experts!
I am working on a website in ASP.Net/C#.Net.I am new to .Net Platform and also new to Web Development. My problem is.... if i change the name of any of the controls in an aspx page .... for example there is a textbox... when i change its name... i get an error message "The Directory Name is Invalid". And the IDE resets its name to the previous one. I mean i m not able to change its name.
Thanx in Advance!
Regards
IPS
|
|
|
|
|
I think u r changing it when running the program.Stop the program go to source and change the name
|
|
|
|
|
honeyss wrote: I think u r changing it when running the program
No i am not changing it at run time.
|
|
|
|
|
Probably you would be giving invalid name to them. Can you tell what names are you trying to assign.
Apurva Kaushal
|
|
|
|
|
Apurva Kaushal wrote: Probably you would be giving invalid name to them
No i am not giving any invalid name. say if textbox's name is tbFirstname.. then i am changing it to tbFaxNo. thats it!
|
|
|
|
|
Which version of asp.net are you working on?
Apurva Kaushal
|
|
|
|
|
I have experience with this problem!
You can try to change its name in HTML tag ID="TextBox1" in source page.
Example :
<asp:textbox <b="">id="TextBox1" runat="server">
Good luck
junior boy
|
|
|
|
|
Junior Boy wrote: You can try to change its name in HTML tag ID="TextBox1" in source page.
Example :
id="TextBox1" runat="server">
Hey Junior Boy.... it has solved my problem.. Thanx..! but i just want to know why did it happen? Can u tell me the reason?
|
|
|
|
|
|
Me too experienced the same probs long back..
Its due to reference and dependencies made by the control to the register.....
Hope u can do it now...
SAJAN A PILLAI
C#.NET Programmer
TELESOFT INDIA PVT LTD...
BANGALORE
|
|
|
|