how to manipulate files on the server side

Discussion in 'ASP General' started by Tim, Oct 3, 2005.

  1. Tim

    Tim Guest

    I need to manipulate files (rtf and wav files) on the server side. Can you
    show me how to do that?
    Thank you,
     
    Tim, Oct 3, 2005
    #1
    1. Advertising

  2. Tim

    Evertjan. Guest

    =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    microsoft.public.inetserver.asp.general:

    > I need to manipulate files (rtf and wav files) on the server side. Can
    > you show me how to do that?
    >


    You mean like creating, deleting, moving, copying?

    see the faq:

    "Scripting.FileSystemObject"

    <http://www.aspfaq.com/show.asp?id=2211>
    <http://www.aspfaq.com/show.asp?id=2170>
    etc.

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Oct 3, 2005
    #2
    1. Advertising

  3. Tim

    Tim Guest

    Thank you for your response. No, I don't mean to creating, deleting...I have
    rtf and wav files on the server and the users will access these files. What
    is the code for showing the map path for them to access these files? And how
    these files are shown up on the web browser.
    Thank you.

    "Evertjan." wrote:

    > =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    > microsoft.public.inetserver.asp.general:
    >
    > > I need to manipulate files (rtf and wav files) on the server side. Can
    > > you show me how to do that?
    > >

    >
    > You mean like creating, deleting, moving, copying?
    >
    > see the faq:
    >
    > "Scripting.FileSystemObject"
    >
    > <http://www.aspfaq.com/show.asp?id=2211>
    > <http://www.aspfaq.com/show.asp?id=2170>
    > etc.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
    >
     
    Tim, Oct 3, 2005
    #3
  4. Tim

    Evertjan. Guest

    =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    microsoft.public.inetserver.asp.general:
    > "Evertjan." wrote:
    >
    >> =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    >> microsoft.public.inetserver.asp.general:
    >>
    >> > I need to manipulate files (rtf and wav files) on the server side.
    >> > Can you show me how to do that?
    >> >

    >>
    >> You mean like creating, deleting, moving, copying?
    >>
    >> see the faq:
    >>
    >> "Scripting.FileSystemObject"
    >>
    >> <http://www.aspfaq.com/show.asp?id=2211>
    >> <http://www.aspfaq.com/show.asp?id=2170>
    >> etc.


    [please do not toppost on usenet]

    > Thank you for your response. No, I don't mean to creating,
    > deleting...I have rtf and wav files on the server and the users will
    > access these files. What is the code for showing the map path for them
    > to access these files? And how these files are shown up on the web
    > browser. Thank you.


    If they are in the scope of the www root you can just use them:

    <img src='/mydir/mysubdir/mypic.jpg'>

    if they are not, you can move them by hand.

    If you do not want them in he scope, you can fetch them:

    <img src='/mydir/fetchMe.asp'>

    where /mydir/fetchMe.asp is:

    <%
    outputJPG("mypic.jpg")


    function outputJPG(x)

    strFileName="c:\noScopedir\" & x
    strFilePath=server.mappath(strFilename)

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    if objFSO.FileExists(strFilePath) then
    Set objStream = Server.CreateObject("ADODB.Stream")
    objStream.Open

    objStream.Type = 1
    objStream.LoadFromFile strFilePath

    Response.Buffer = false
    Response.ContentType = ""
    Response.AddHeader "Content-Type", "image/Jpeg"

    Response.BinaryWrite objStream.Read
    Response.Flush
    objStream.Close
    Set objStream = Nothing
    else
    response.write "None existing"
    end if
    Set objFSO = Nothing

    Response.end
    end function
    %>




    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Oct 3, 2005
    #4
  5. Tim

    Tim Guest

    In your code, it deals with .jpg picture file. I assume it would work with
    rtf and wav (sound file), too. I will check...
    Again, thank you for your help. I appreciate it.
    Tim.

    "Evertjan." wrote:

    > =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    > microsoft.public.inetserver.asp.general:
    > > "Evertjan." wrote:
    > >
    > >> =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    > >> microsoft.public.inetserver.asp.general:
    > >>
    > >> > I need to manipulate files (rtf and wav files) on the server side.
    > >> > Can you show me how to do that?
    > >> >
    > >>
    > >> You mean like creating, deleting, moving, copying?
    > >>
    > >> see the faq:
    > >>
    > >> "Scripting.FileSystemObject"
    > >>
    > >> <http://www.aspfaq.com/show.asp?id=2211>
    > >> <http://www.aspfaq.com/show.asp?id=2170>
    > >> etc.

    >
    > [please do not toppost on usenet]
    >
    > > Thank you for your response. No, I don't mean to creating,
    > > deleting...I have rtf and wav files on the server and the users will
    > > access these files. What is the code for showing the map path for them
    > > to access these files? And how these files are shown up on the web
    > > browser. Thank you.

    >
    > If they are in the scope of the www root you can just use them:
    >
    > <img src='/mydir/mysubdir/mypic.jpg'>
    >
    > if they are not, you can move them by hand.
    >
    > If you do not want them in he scope, you can fetch them:
    >
    > <img src='/mydir/fetchMe.asp'>
    >
    > where /mydir/fetchMe.asp is:
    >
    > <%
    > outputJPG("mypic.jpg")
    >
    >
    > function outputJPG(x)
    >
    > strFileName="c:\noScopedir\" & x
    > strFilePath=server.mappath(strFilename)
    >
    > Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    > if objFSO.FileExists(strFilePath) then
    > Set objStream = Server.CreateObject("ADODB.Stream")
    > objStream.Open
    >
    > objStream.Type = 1
    > objStream.LoadFromFile strFilePath
    >
    > Response.Buffer = false
    > Response.ContentType = ""
    > Response.AddHeader "Content-Type", "image/Jpeg"
    >
    > Response.BinaryWrite objStream.Read
    > Response.Flush
    > objStream.Close
    > Set objStream = Nothing
    > else
    > response.write "None existing"
    > end if
    > Set objFSO = Nothing
    >
    > Response.end
    > end function
    > %>
    >
    >
    >
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
    >
     
    Tim, Oct 3, 2005
    #5
  6. Tim

    Evertjan. Guest

    =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    microsoft.public.inetserver.asp.general:

    >
    > "Evertjan." wrote:
    >> Response.AddHeader "Content-Type", "image/Jpeg"
    >>


    > In your code, it deals with .jpg picture file. I assume it would work
    > with rtf and wav (sound file), too. I will check...
    > Again, thank you for your help. I appreciate it.
    > Tim.


    With the right "Content-Type" it should.

    <http://reliableanswers.com/contenttype/CType.asp>

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., Oct 3, 2005
    #6
  7. Tim

    Tim Guest

    That's wonderful! Thank you for your helpful link.
    Tim

    "Evertjan." wrote:

    > =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
    > microsoft.public.inetserver.asp.general:
    >
    > >
    > > "Evertjan." wrote:
    > >> Response.AddHeader "Content-Type", "image/Jpeg"
    > >>

    >
    > > In your code, it deals with .jpg picture file. I assume it would work
    > > with rtf and wav (sound file), too. I will check...
    > > Again, thank you for your help. I appreciate it.
    > > Tim.

    >
    > With the right "Content-Type" it should.
    >
    > <http://reliableanswers.com/contenttype/CType.asp>
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Replace all crosses with dots in my emailaddress)
    >
    >
     
    Tim, Oct 5, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mythran
    Replies:
    2
    Views:
    546
    Mythran
    Jan 22, 2005
  2. Thor
    Replies:
    1
    Views:
    1,045
    Mikkel Heisterberg
    Jul 2, 2003
  3. Replies:
    0
    Views:
    485
  4. Replies:
    1
    Views:
    6,365
  5. Dave
    Replies:
    1
    Views:
    346
    Mike Wahler
    Jan 22, 2005
Loading...

Share This Page