Help on Writing Image Information(Location/Descriptions) to a txtfile
-
// Save the stream to disk System.IO.FileStream newFile = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create); newFile.Write(myData, 0, myData.Length); newFile.Close(); TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); // write a line of text to the file tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); // close the stream tw.Close(); on the TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location? also on the tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); the result on the notepad is that it writes exactly the same text to the notepad... how do i make it so that i'll save whatever I input onto my textboxes?
-
// Save the stream to disk System.IO.FileStream newFile = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create); newFile.Write(myData, 0, myData.Length); newFile.Close(); TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); // write a line of text to the file tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); // close the stream tw.Close(); on the TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location? also on the tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); the result on the notepad is that it writes exactly the same text to the notepad... how do i make it so that i'll save whatever I input onto my textboxes?
Thomas Toh wrote:
how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location?
The same as you do for the stream, server.mappath.
Thomas Toh wrote:
how do i make it so that i'll save whatever I input onto my textboxes?
By removing the quotes. txtFName.Text + " " + txtLName.Text + " " + IDTextBox.Text
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Thomas Toh wrote:
how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location?
The same as you do for the stream, server.mappath.
Thomas Toh wrote:
how do i make it so that i'll save whatever I input onto my textboxes?
By removing the quotes. txtFName.Text + " " + txtLName.Text + " " + IDTextBox.Text
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
thanks.. the second one works.. however.. for the first one... is this the correct code? TextWriter tw = new StreamWriter("Server.MapPath/images/info.txt"); also.. if i write 2 or more image files... it will overwrite the exisiting one... how do i make it so that it will write onto next line in my textfile
modified on Thursday, May 1, 2008 9:52 AM
-
thanks.. the second one works.. however.. for the first one... is this the correct code? TextWriter tw = new StreamWriter("Server.MapPath/images/info.txt"); also.. if i write 2 or more image files... it will overwrite the exisiting one... how do i make it so that it will write onto next line in my textfile
modified on Thursday, May 1, 2008 9:52 AM
Wow. OK, what have we learned ? When a string is in quotes, it becomes a literal string, NOT code. Try copying the code you use above, and it will work.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
// Save the stream to disk System.IO.FileStream newFile = new System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create); newFile.Write(myData, 0, myData.Length); newFile.Close(); TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); // write a line of text to the file tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); // close the stream tw.Close(); on the TextWriter tw = new StreamWriter("d://fyp//images//saved images//info.txt"); how do i specify the directory so that it will save to /images on my project folder? without specifying the exact location? also on the tw.WriteLine("txtFName.txt*txtLName*IDTextBox*" + sSavePath + sFilename); the result on the notepad is that it writes exactly the same text to the notepad... how do i make it so that i'll save whatever I input onto my textboxes?
ok thanks... also.. if i write 2 or more image files... it will overwrite the exisiting one... how do i make it so that it will write onto next line in my textfile