Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
Generalitems painted Pin
netJP12L13-Feb-08 9:14
netJP12L13-Feb-08 9:14 
GeneralRe: items painted Pin
Christian Graus13-Feb-08 9:29
protectorChristian Graus13-Feb-08 9:29 
GeneralRe: items painted Pin
netJP12L14-Feb-08 4:25
netJP12L14-Feb-08 4:25 
GeneralFile.io - creating a back up file syntax error Pin
Shane Smart13-Feb-08 9:05
Shane Smart13-Feb-08 9:05 
GeneralRe: File.io - creating a back up file syntax error Pin
DaveyM6913-Feb-08 9:21
professionalDaveyM6913-Feb-08 9:21 
GeneralRe: File.io - creating a back up file syntax error Pin
Shane Smart13-Feb-08 11:19
Shane Smart13-Feb-08 11:19 
GeneralTerminate (clean way) a Windows Service from inside Pin
Federico Milano13-Feb-08 6:41
Federico Milano13-Feb-08 6:41 
Generalupload the wave file (without asp.net control) using c# . Pin
pachan13-Feb-08 4:48
pachan13-Feb-08 4:48 
The following code is used to upload the wave(vox) file(without asp.net control) using c# .

Its IVR project.

Front end :voicexml
Back end :c# aspx


RecordAudio.cs
***************
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Web;
using System.IO;

namespace DMVEmergencyMessagesUtil
{
public class RecordAudio
{
UploadedFile upFile = new UploadedFile();
Stream s = null;
Stream sGetFileName = null;
Byte[] streamArray = null;
public void EquivalentConversion(string strFilePath, string strFileName, string strFileType, Stream s1)
{
s = s1; //HttpContext.Current.Request.InputStream;
string biData, sInputName, vDataBounds;
int nPosBegin, nPosEnd, nPos, nDataBoundPos, nPosFile, nPosBound;
char c = (char)13; //return key
byte[] bytArr = new byte[HttpContext.Current.Request.TotalBytes];

string strCheck = bytArr.GetValue(5).ToString();
biData = RequestInputStreamToString();
nPosBegin = 1;
nPosEnd = biData.IndexOf(c);
if (nPosEnd > 0)
{
}
if ((nPosEnd - nPosBegin) <= 0)
{
return;
}
vDataBounds = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
nDataBoundPos = biData.IndexOf(vDataBounds, 1);
string sFileName = string.Empty;
string sFileNamePath = string.Empty;
string ContentType = string.Empty;
string tempdata = string.Empty;

do
{
nPos = biData.IndexOf("Content-Disposition", nDataBoundPos);
nPos = biData.IndexOf("name=", nPos);
nPosBegin = nPos + 6;
nPosEnd = biData.IndexOf((char)34, nPosBegin);
sInputName = biData.Substring(nPosBegin, nPosEnd - nPosBegin + 1);
nPosFile = biData.IndexOf("filename=", nDataBoundPos);
nPosBound = biData.IndexOf(vDataBounds, nPosEnd);

if (nPosFile != 0)//&& nPosFile < nPosBound)
{
nPosBegin = nPosFile + 10;
nPosEnd = biData.IndexOf((char)34, nPosBegin);
sFileName = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
sFileNamePath = sFileName;
nPos = biData.IndexOf("Content-Type:", nPosEnd);
nPosBegin = nPos + 14;
nPosEnd = biData.IndexOf((char)13, nPosBegin);
upFile.ContentType = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
ContentType = upFile.ContentType;
nPosBegin = nPosEnd + 4;
nPosEnd = biData.IndexOf(vDataBounds, nPosBegin) - 2;
upFile.setArrSize = nPosEnd - nPosBegin;
Array.Copy(streamArray, nPosBegin, upFile.m_fileDataNew, 0, nPosEnd - nPosBegin);
upFile.FileData = biData.Substring(nPosBegin, nPosEnd - nPosBegin);
upFile.FileName = strFileName;
upFile.FileType = strFileType;
string strPath = HttpContext.Current.Server.MapPath(strFilePath);
strPath = strPath + strFileName + strFileType;
upFile.SaveToDisk(strPath);
}
} while (nDataBoundPos == biData.IndexOf(vDataBounds + "--"));

}

public string RequestInputStreamToString()
{
StringBuilder sb = new StringBuilder();
int streamLength; int streamRead;
streamLength = Convert.ToInt32(s.Length); streamArray = new Byte[streamLength];
streamArray.ToString();
streamRead = s.Read(streamArray, 0, streamLength);
string test = System.Text.Encoding.Default.GetString(streamArray); for (int i = 0; i < streamLength; i++)
{
sb.Append(Convert.ToChar(streamArray[i]));
if (i == 150)
{
sb.ToString();
}
}
return sb.ToString();
}

}
}



UploadedFile.cs
***************
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.IO;



namespace DMVEmergencyMessagesUtil
{
public class UploadedFile
{
public UploadedFile()
{

//m_fileDataNew = new byte[arrLen];

}
public byte[] m_fileDataNew;

private string m_contentType, m_fileName, m_fileData,m_fileType;

public string ContentType
{
set
{
m_contentType = value;
}
get
{
return m_contentType;
}
}
public string FileType
{
set
{
m_fileType = value;
}
get
{
return m_fileType;
}
}

public Int32 setArrSize
{
set
{
m_fileDataNew = new byte[value];

}
}

public string FileName
{
set
{
m_fileName = value;
}
get
{
return m_fileName;
}
}

public string FileData
{
set
{
m_fileData = value;
}
get
{
return m_fileData;

}
}

public int getfileSize()
{
return FileData.Length;

}

public void SaveToDisk(string sPath)
{
if (sPath == string.Empty) return;
string MyString = FileData;
byte[] data = Encoding.Default.GetBytes(MyString);
FileStream fs = File.Create(sPath);
fs.Write(m_fileDataNew, 0, m_fileDataNew.Length);
fs.Close();
}

}
}

RecordMessage.aspx
*******************



]]>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">


]]>
]]>
]]>
]]>
]]>
]]>
]]>
]]>


]]>
<block>
<return>



GeneralRe: upload the wave file (without asp.net control) using c# . Pin
phannon8613-Feb-08 4:56
professionalphannon8613-Feb-08 4:56 
GeneralRe: upload the wave file (without asp.net control) using c# . Pin
Not Active13-Feb-08 6:13
mentorNot Active13-Feb-08 6:13 
Generalarchitecture Pin
ellllllllie13-Feb-08 4:42
ellllllllie13-Feb-08 4:42 
GeneralRe: architecture Pin
Expert Coming13-Feb-08 4:46
Expert Coming13-Feb-08 4:46 
GeneralRe: architecture Pin
ellllllllie13-Feb-08 5:00
ellllllllie13-Feb-08 5:00 
GeneralRe: architecture Pin
engsrini13-Feb-08 8:55
engsrini13-Feb-08 8:55 
JokeRe: architecture Pin
MarkB77713-Feb-08 8:59
MarkB77713-Feb-08 8:59 
GeneralRe: architecture Pin
Pete O'Hanlon13-Feb-08 10:39
mvePete O'Hanlon13-Feb-08 10:39 
GeneralRe: architecture Pin
Christian Graus13-Feb-08 9:29
protectorChristian Graus13-Feb-08 9:29 
GeneralRe: architecture Pin
Mark Churchill13-Feb-08 11:09
Mark Churchill13-Feb-08 11:09 
GeneralRe: architecture Pin
led mike13-Feb-08 11:36
led mike13-Feb-08 11:36 
GeneralRe: architecture Pin
Mark Churchill13-Feb-08 14:50
Mark Churchill13-Feb-08 14:50 
GeneralRe: architecture Pin
ellllllllie13-Feb-08 22:01
ellllllllie13-Feb-08 22:01 
Generalldd Pin
ellllllllie13-Feb-08 4:23
ellllllllie13-Feb-08 4:23 
GeneralRe: ldd Pin
DaveyM6913-Feb-08 4:44
professionalDaveyM6913-Feb-08 4:44 
GeneralDataBinding value to expression that looks at multiple object values Pin
jchalfant13-Feb-08 4:02
jchalfant13-Feb-08 4:02 
GeneralRe: DataBinding value to expression that looks at multiple object values Pin
KaptinKrunch13-Feb-08 4:23
KaptinKrunch13-Feb-08 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.