473,772 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a new empty text file?

Hi experts,

I want to create a new empty text file after I upload a file to
the desination. Then I need to read each line from the uploaded file
and write the lines which first character <>'6' to the new
file.
Can someone show me how to do this? First of all, what is the syntax
to create a new text file? Thank you.

This is the funcation for upload file:
-----------------------------------------------------------------

Sub Upload_Click(By Val source As Object, ByVal e As EventArgs)
Dim savePath As String = "C:\temp\"
Dim postedFile = uploadedFile.Po stedFile
Dim filename As String =
Path.GetFileNam e(postedFile.Fi leName)
Dim contentType As String = postedFile.Cont entType
Dim contentLength As Integer = postedFile.Cont entLength
If Not (uploadedFile.P ostedFile Is Nothing) Then
Try
'upload file to destination directory
postedFile.Save As(savePath & filename)
message.Text = postedFile.File name & " uploaded"
& _
"<br>conten t type: " & contentType &
_
"<br>conten t length: " &
contentLength.T oString()
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
End If
'Create a new text file

End Sub

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 19 '05 #1
1 4815
Hi...

If you are using ASP.NET to upload the file, you can use the HtmlInputFile
control.
On the server, the file appears as an HttpPostedFile and can be retreived
by:

upLoadControl.P ostedFile.

So, if you wanted to save the uploaded file, you could simply do something
like:

upLoadControl.P ostedFile.SaveA s(filename);

Hope this helps,

John Puopolo
"JenHu" <je**********@h otmail-dot-com.no-spam.invalid> wrote in message
news:41******** **@Usenet.com.. .
Hi experts,

I want to create a new empty text file after I upload a file to
the desination. Then I need to read each line from the uploaded file
and write the lines which first character <>'6' to the new
file.
Can someone show me how to do this? First of all, what is the syntax
to create a new text file? Thank you.

This is the funcation for upload file:
-----------------------------------------------------------------

Sub Upload_Click(By Val source As Object, ByVal e As EventArgs)
Dim savePath As String = "C:\temp\"
Dim postedFile = uploadedFile.Po stedFile
Dim filename As String =
Path.GetFileNam e(postedFile.Fi leName)
Dim contentType As String = postedFile.Cont entType
Dim contentLength As Integer = postedFile.Cont entLength
If Not (uploadedFile.P ostedFile Is Nothing) Then
Try
'upload file to destination directory
postedFile.Save As(savePath & filename)
message.Text = postedFile.File name & " uploaded"
& _
"<br>conten t type: " & contentType &
_
"<br>conten t length: " &
contentLength.T oString()
Catch exc As Exception
message.Text = "Failed uploading file"
End Try
End If
'Create a new text file

End Sub

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 19 '05 #2

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

Similar topics

7
8869
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
3
2649
by: Peter | last post by:
Hello! Please, could you tell me, is it possible to create and stream for example a text file to the browser so that the file is not stored anywhere on a hard drive? User click's a link, eg. http://my.domain.com/apps/app/page.aspx?docID=235 and then the text file opens with a text "235" and when the user closes the file there is not track of the file anywhere on a hard drive.
8
20369
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1: Start with original thumbnails & two empty sub directories STEP 2: Create smaller versions of the originals for one sub directory STEP 3: Create thumbnail version of the originals the other sub directory STEP 4: Create an index.html pointing to the...
0
3231
by: Niyazi | last post by:
Hi, I created application that store the data in SQL SERVER that reside on network. The client also use this application to access the resources provided with application. But is the client want to register new customer or companies they will enter the information in Windows Form and the program automaticaly creates the WORD document under specific folder under application path. Once the empty word file created than ask user if they want...
23
7416
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
11
5078
by: ra294 | last post by:
I am building a page that needs to recieve some parametes and return blank page (empty response). After I recieve the parametes I write: Response.clear Response.End When I run the page I still get some html when doing "view source" in IE: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD>
1
32947
by: ujjwaltrivedi | last post by:
Hey guys, Can anyone tell me how to create a text file with Unicode Encoding. In am using FileStream Finalfile = new FileStream("finalfile.txt", FileMode.Append, FileAccess.Write); ###Question: Now this creates finalfile.txt with ANSI Encoding ...which is a default. Either tell me how to change the default or how to create a
2
2784
by: nja2222 | last post by:
I would like to create a page for my clients to login and check for updates on their accounts. Then I would like to create a page where my employees can login and make updates, specifically new file uploads, to the clients accounts. I have seen similar sites everywhere, such as bank websites, USPS site, et cetera. What is required to accomplish this? I'm trying to do this with the PHP, MySQL and Adobe CS3 Master collection's 'Dreamweaver CS3' ...
5
2175
by: aktar | last post by:
The code below adds a file field only if no other file field is empty. The code works as expected in FF and Opera. However in IE7, it will only create one additional field. Can anyone explain why IE7 refuses to create any more fields? <script type="text/javascript" language="javascript"> //initialises the container function init() {
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10103
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.