ispcorp
asked on
Upload type=File into memory
Hello,
I would like to upload an excel file into memory. I do not want to save it any where, just bring it on up to memory, parse throught the excel file into properties on an object and release it from memory. I already have the class objects with the properties I want to populate, and I know how to parse a physical excel file if I just pass the path to the excel object...
My question is how do I pass the file loaded into memory into an object with out first saving the file on the server? Thanks
I would like to upload an excel file into memory. I do not want to save it any where, just bring it on up to memory, parse throught the excel file into properties on an object and release it from memory. I already have the class objects with the properties I want to populate, and I know how to parse a physical excel file if I just pass the path to the excel object...
My question is how do I pass the file loaded into memory into an object with out first saving the file on the server? Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, I'll wait a day and see if anybody else gives me a different response. If its not possible, then I'll give you the points. Thanks, though....
ASKER
Hey DanaTaylor...What I mean by uploading it into memory is to take the "FILE", which is designation by the following html tag...
<Input ID="MyFile" Type="File" accept="text/comma-separat ed-values" RunAt="Server" Size="40">
and take the "myFile" object, pass it into another object, open it (but not save it), parse it and then release it from memory.
<Input ID="MyFile" Type="File" accept="text/comma-separat
and take the "myFile" object, pass it into another object, open it (but not save it), parse it and then release it from memory.
Oh! I understand now. Tricky...I'm with Fritz - Don't think you can do it.
Of course, usually, as soon as I say that someone shows me how...
Then someone else shows me how to do it better...
Of course, usually, as soon as I say that someone shows me how...
Then someone else shows me how to do it better...
If the excel file existed on another server, you could try using something like this to get a text string from it:
Function GetHTML(strURL)
Dim objXMLHTTP, strReturn
Set objXMLHTTP = Server.CreateObject("MSXML 2.ServerXM LHTTP")
objXMLHTTP.Open "GET", strURL, False
objXMLHTTP.Send
strReturn = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
GetHTML = strReturn
End Function
That would give you the contents as a string variabile, but it doesn't sound like this matches your situation and this is the only way that I know how to do it.
FtB
Function GetHTML(strURL)
Dim objXMLHTTP, strReturn
Set objXMLHTTP = Server.CreateObject("MSXML
objXMLHTTP.Open "GET", strURL, False
objXMLHTTP.Send
strReturn = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
GetHTML = strReturn
End Function
That would give you the contents as a string variabile, but it doesn't sound like this matches your situation and this is the only way that I know how to do it.
FtB
ASKER
Yes, its doens't match my situation because I would like to reference it just like I would if I opened up a physical excel file on my server. By the way, I should also mention that I'm coding using VB.NET...
Still no difference there--there is no simple way to pass the contents of a file on the client to a memory variable on the server.
FtB
FtB
ASKER
I'm trying out a way of passing in the hmtl control and opening it up with the excel api using the PostedFile.FileName property. I doubt it will work, but its worth a try...
-Tom
-Tom
No luck?
If you ever come across a solution, please post it here!
FtB
If you ever come across a solution, please post it here!
FtB
<%@ Language=VBScript %>
<html xmlns:o="urn:schemas-micro
xmlns:x="urn:schemas-micro
<HEAD>
</HEAD>
<BODY>
<%
Response.ContentType = "application/vnd.ms-excel"
Response.Write "<TABLE>"
Response.Write "<TR><TD colspan=3>Get all the fields you need from your database.</TD></TR>"
Response.Write "<TR><TD colspan=3>Then cycle through them as you normally would.</TD></TR>"
Response.Write "<TR><TD colspan=3>Then put them in a table for formatting just like you would in a Web Table.</TD></TR>"
Response.Write "<TR><TD colspan=3></TD></TR>"
Response.Write "<TR>"
Response.Write "<TH>Name</TH>"
Response.Write "<TH>Address</TH>"
Response.Write "<TH>City-State-ZIP</TH>"
Response.Write "</TR>"
dim I
for I = 1 to 10
Response.Write "<TR>"
Response.Write "<TD>Fname_Lname_" & I & "</TD>"
Response.Write "<TD>Address_" & I & "</TD>"
Response.Write "<TD>City_State_ZIP_" & I & "</TD>"
Response.Write "</TR>"
next
Response.Write "</TABLE>"
%>
</BODY>
</HTML>