kma07
07-09-2010, 05:28 AM
Hey all
I've created a page where the user browses his/hers machine and is able to upload the file onto a server.
Now once it has been uploaded onto the server, I need it to call an external program (that runs a .exe to convert this file) then once it's processed, I need it to send this file to the user's email address (that they have entered)
Any help would be greatly appreciated!
I've been trying to complete this for a while !!:eek:
<%@ Page Language="VB"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TRANSFER</title>
</head>
<Script Language="VB" RunAt="Server">
Sub Page_Load(Sender as Object, e as EventArgs)
Dim MyPath, MyName As String
' Display the names in C:\ that represent directories.
MyPath = "//my//d$//folders//file//uploads//" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
if MyName="" ' The folder is not there & to be created
MkDir("//my//d$//folders//file//uploads//") 'Folder created
Span2.InnerHtml = "A Folder (////my//d$//folders//file//uploads//) is created at the Page_Load"
end if
End Sub
Sub Upload_Click(Sender as Object, e as EventArgs)
' Display properties of the uploaded file
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
UploadDetails.visible = True
' Let us recover only the file name from its fully qualified path at client
Dim strFileName as string
strFileName = MyFile.PostedFile.FileName
Dim c as string = System.IO.Path.GetFileName(strFileName) ' only the attched file name not its path
' Let us Save uploaded file to server at //my//d$//folders//file//uploads//
Try
MyFile.PostedFile.SaveAs("//my//d$//folders//file//uploads//" + c)
Span1.InnerHtml = "Your File Uploaded Sucessfully at server as : //my//d$//folders//file//uploads//" & c
catch Exp as exception
span1.InnerHtml = "An Error occured. Please check the attached file"
UploadDetails.visible = false
span2.visible=false
End Try
End Sub
</Script>
<Body>
<Font Color="DarkGreen" Face=Helvetica Size=5> <B>ONIX GEISHA TRANSFER</B>
</Font>
<HR Size="2" Color=Black >
<P>
<Form id="Form2" Method="Post" EncType="Multipart/Form-Data" RunAt="Server">
Choose Your File To Upload : <BR>
<Input ID="MyFile" Type="File" RunAt="Server" Size="40"> <BR>
<BR>
<Input id="Submit1" Type="Submit" Value="Upload" OnServerclick="Upload_Click" RunAt="Server">
<P>
<Div ID="UploadDetails" Visible="False" RunAt="Server">
File Name: <Span ID="FileName" RunAt="Server"/> <BR>
File Content: <Span ID="FileContent" RunAt="Server"/>
<BR>
File Size: <Span ID="FileSize" RunAt="Server"/>bytes
<BR></Div>
<Span ID="Span1" Style="Color:Red" RunAt="Server"/>
<Span ID="Span2" Style="Color:Red" RunAt="Server"/>
</P></P>
<HR Size="2" Color=Black>
<form>
</Form>
</Body>
</html>
I've created a page where the user browses his/hers machine and is able to upload the file onto a server.
Now once it has been uploaded onto the server, I need it to call an external program (that runs a .exe to convert this file) then once it's processed, I need it to send this file to the user's email address (that they have entered)
Any help would be greatly appreciated!
I've been trying to complete this for a while !!:eek:
<%@ Page Language="VB"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>TRANSFER</title>
</head>
<Script Language="VB" RunAt="Server">
Sub Page_Load(Sender as Object, e as EventArgs)
Dim MyPath, MyName As String
' Display the names in C:\ that represent directories.
MyPath = "//my//d$//folders//file//uploads//" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
if MyName="" ' The folder is not there & to be created
MkDir("//my//d$//folders//file//uploads//") 'Folder created
Span2.InnerHtml = "A Folder (////my//d$//folders//file//uploads//) is created at the Page_Load"
end if
End Sub
Sub Upload_Click(Sender as Object, e as EventArgs)
' Display properties of the uploaded file
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
UploadDetails.visible = True
' Let us recover only the file name from its fully qualified path at client
Dim strFileName as string
strFileName = MyFile.PostedFile.FileName
Dim c as string = System.IO.Path.GetFileName(strFileName) ' only the attched file name not its path
' Let us Save uploaded file to server at //my//d$//folders//file//uploads//
Try
MyFile.PostedFile.SaveAs("//my//d$//folders//file//uploads//" + c)
Span1.InnerHtml = "Your File Uploaded Sucessfully at server as : //my//d$//folders//file//uploads//" & c
catch Exp as exception
span1.InnerHtml = "An Error occured. Please check the attached file"
UploadDetails.visible = false
span2.visible=false
End Try
End Sub
</Script>
<Body>
<Font Color="DarkGreen" Face=Helvetica Size=5> <B>ONIX GEISHA TRANSFER</B>
</Font>
<HR Size="2" Color=Black >
<P>
<Form id="Form2" Method="Post" EncType="Multipart/Form-Data" RunAt="Server">
Choose Your File To Upload : <BR>
<Input ID="MyFile" Type="File" RunAt="Server" Size="40"> <BR>
<BR>
<Input id="Submit1" Type="Submit" Value="Upload" OnServerclick="Upload_Click" RunAt="Server">
<P>
<Div ID="UploadDetails" Visible="False" RunAt="Server">
File Name: <Span ID="FileName" RunAt="Server"/> <BR>
File Content: <Span ID="FileContent" RunAt="Server"/>
<BR>
File Size: <Span ID="FileSize" RunAt="Server"/>bytes
<BR></Div>
<Span ID="Span1" Style="Color:Red" RunAt="Server"/>
<Span ID="Span2" Style="Color:Red" RunAt="Server"/>
</P></P>
<HR Size="2" Color=Black>
<form>
</Form>
</Body>
</html>