[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Upload type=File into memory

Posted on 2005-04-19
10
Medium Priority
?
246 Views
Last Modified: 2006-11-18
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
0
Comment
Question by:ispcorp
  • 4
  • 4
  • 2
10 Comments
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 2000 total points
ID: 13817282
I don't believe that you can. In order to get it into memory, you would first have to open it, and of course, it would have to be on your server to do so.

FtB
0
 
LVL 9

Expert Comment

by:danataylor
ID: 13817478
Don't  know exactly what you mean by uploading to memory but this will stuff your data into an Excel spreadsheet on the client machine for review.  If you don't want to save it to the hard drive then just close Excel without saving.

<%@ Language=VBScript %>
<html xmlns:o="urn:schemas-microsoft-com:office:office"             <%' Office XML Namespace    %>
          xmlns:x="urn:schemas-microsoft-com:office:excel">           <%' Excel XML Namespace     %>
<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>
0
 
LVL 2

Author Comment

by:ispcorp
ID: 13817487
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....
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Author Comment

by:ispcorp
ID: 13817523
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-separated-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.  
0
 
LVL 9

Expert Comment

by:danataylor
ID: 13817693
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...
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13818101
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("MSXML2.ServerXMLHTTP")
      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
0
 
LVL 2

Author Comment

by:ispcorp
ID: 13818267
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...
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13818452
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
0
 
LVL 2

Author Comment

by:ispcorp
ID: 13818483
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
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13827846
No luck?

If you ever come across a solution, please post it here!


FtB
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question