Jump to content

Recommended Posts

Posted

I have a page where users can submit text. How do I make the C# code save to the website (a .txt file) to a certain folder.

 

When I ran my website from home it was like this...

 

writer= new StreamWriter(@"\iFrameContents\codeSnippets\snippetsList.list");

writer.WriteLine(temp + authorName.Text + "-" + codeName.Text + " " + id.ToString());

writer.Close();

 

*thats just a small part of it.. the part that writes the new submission name to the list of submitted texts, thus the ".list" extension on the file, but it is still in plain text.

**the other part makes a file with that name and writes the text inside it. that is the one with the ".txt" extension

 

Since I do not have rights to the file system (i think) I can't do it like that here.

 

 

 

Thanks!

Posted

I am unfamiliar with C#. However, you have write permissions to your files. You should be able to set write permissions through the file manager.

Posted
I am unfamiliar with C#. However, you have write permissions to your files. You should be able to set write permissions through the file manager.

well thats good, once my website is up I'll test if i can write.

 

Thanks!

  • 2 weeks later...
Posted
I am unfamiliar with C#. However, you have write permissions to your files. You should be able to set write permissions through the file manager.

 

My url is http://oz.heliohost.org/. If I want to make a file in http://oz.heliohost.org/Programming/IFrame...s/codeSnippets/ what path would i use?

 

I need a drive and folder path, something like C:/heliohost/users/oz/Programming/IFrameContents/codeSnippets/. Do you know what the path would be?

 

Posted
Your path would look like this:

 

/home/oz/public_html/Programming/IFrameContents/codeSnippets/

 

I think I can't use that. I need the whole deal, including the drive letter. This is because if I use

/home/oz/public_html/Programming/IFrameContents/codeSnippets/

from oz.heliohost.org/programming/Home... if will save to

oz.heliohost.org/programming/Home/home/oz/public_html/Programming/IFrameContents/codeSnippets/

 

So I need the whole path so i can save to the same place always.

 

Posted

That is the complete path but you don't have to use the complete path.

 

Is that what your wanting to do is append those urls together? Whatever your doing just use relative paths and remove the parts you don't need.

 

/home/oz/public_html/Programming/IFrameContents/codeSnippets/

from oz.heliohost.org/programming/Home... if will save to

oz.heliohost.org/programming/Home/home/oz/public_html/Programming/IFrameContents/codeSnippets/

 

Posted
That is the complete path but you don't have to use the complete path.

 

Is that what your wanting to do is append those urls together? Whatever your doing just use relative paths and remove the parts you don't need.

 

/home/oz/public_html/Programming/IFrameContents/codeSnippets/

from oz.heliohost.org/programming/Home... if will save to

oz.heliohost.org/programming/Home/home/oz/public_html/Programming/IFrameContents/codeSnippets/

 

No I want to save to a folder, if I don't have a drive letter it wont work right. I just need a full path. other wise I'll have to resort to FTP uploads and downloads to save and read data. FTP Would just be pain in the butt. :wacko:

Posted

Looks like you need to add a line break so your urls are seperated. I have know idea how you do it with C# but with php you just add it like this:

 

"oz.heliohost.org/Programming/IFrameContents/codeSnippets/\n\n"

"oz.heliohost.org/programming/Home/\n\n"

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...