how to manipulate files on the server side

T

Tim

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

Tim

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.
 
E

Evertjan.

=?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
microsoft.public.inetserver.asp.general:
[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
%>
 
T

Tim

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. said:
=?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
microsoft.public.inetserver.asp.general:
[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
%>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top