1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

open files

Discussion in 'C#' started by alun7, Jul 5, 2007.

  1. #1
    hi... 
    
    <%
    
    Dim objFolder   
    
     Set fso=Server.CreateObject("Scripting.FileSystemObject")
    Set objFolder = fso.GetFolder("C:\Inetpub\wwwroot\CLS1\FA\Uploads")
    
    For Each objFile in objFolder.Files 
         Response.Write("<u>" &objFile.Name &"<u><br>")	
    Next
    
    For Each objFile in objFolder.subfolders
         Response.Write("<u>" &objFile.Name &"<u><br>")	
    Next
    
    %>
    PHP:
    how do i open the files<u>" &objFile.Name &"<u>????? like make it got save and open button
     
    alun7, Jul 5, 2007 IP
  2. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #2
    you need to push out the file with response - first you could hit the registry to determine the mime type... then push out the response.content-type as whatever, and it would display the pushed out binary file as whatever type of file it is :)
     
    ccoonen, Jul 6, 2007 IP
  3. alun7

    alun7 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    waa... how come so hard to open a file..
     
    alun7, Jul 6, 2007 IP
  4. malkassem

    malkassem Peon

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Give this a shot:

    
    <%Dim objFolder 
    Set fso=Server.CreateObject("Scripting.FileSystemObject")
    Set objFolder = fso.GetFolder("C:\Inetpub\wwwroot\CLS1\FA\Uploads")
    For Each objFile in objFolder.Files
    [INDENT]Response.Write("<u>" &objFile.Name &"<u><br>")[/INDENT]
    [INDENT]Set ofile = fso.opentextfile(objFile.path, 1, True)[/INDENT]
    [INDENT]Response.Write("<u>" & ofile.readAll() &"<u><br>")[/INDENT]
    Next
    For Each objFile in objFolder.subfolders
    [INDENT]Response.Write("<u>" &objFile.Name &"<u><br>")[/INDENT]
    Next
    %>
    
    Code (markup):
     
    malkassem, Jul 8, 2007 IP