Connecting Tech Pros Worldwide Forums | Help | Site Map

how to manipulate files on the server side

Tim
Guest
 
Posts: n/a
#1: Oct 3 '05
I need to manipulate files (rtf and wav files) on the server side. Can you
show me how to do that?
Thank you,

Evertjan.
Guest
 
Posts: n/a
#2: Oct 3 '05

re: how to manipulate files on the server side


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

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
Guest
 
Posts: n/a
#3: Oct 3 '05

re: how to manipulate files on the server side


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:
[color=blue]
> =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
> microsoft.public.inetserver.asp.general:
>[color=green]
> > I need to manipulate files (rtf and wav files) on the server side. Can
> > you show me how to do that?
> >[/color]
>
> 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)
>
>[/color]
Evertjan.
Guest
 
Posts: n/a
#4: Oct 3 '05

re: how to manipulate files on the server side


=?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
microsoft.public.inetserver.asp.general:[color=blue]
> "Evertjan." wrote:
>[color=green]
>> =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
>> microsoft.public.inetserver.asp.general:
>>[color=darkred]
>> > I need to manipulate files (rtf and wav files) on the server side.
>> > Can you show me how to do that?
>> >[/color]
>>
>> 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.[/color][/color]

[please do not toppost on usenet]
[color=blue]
> 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.[/color]

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
Guest
 
Posts: n/a
#5: Oct 3 '05

re: how to manipulate files on the server side


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:
[color=blue]
> =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
> microsoft.public.inetserver.asp.general:[color=green]
> > "Evertjan." wrote:
> >[color=darkred]
> >> =?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.[/color][/color]
>
> [please do not toppost on usenet]
>[color=green]
> > 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.[/color]
>
> 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)
>
>[/color]
Evertjan.
Guest
 
Posts: n/a
#6: Oct 3 '05

re: how to manipulate files on the server side


=?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
microsoft.public.inetserver.asp.general:
[color=blue]
>
> "Evertjan." wrote:[color=green]
>> Response.AddHeader "Content-Type", "image/Jpeg"
>>[/color][/color]
[color=blue]
> 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.[/color]

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
Guest
 
Posts: n/a
#7: Oct 5 '05

re: how to manipulate files on the server side


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

"Evertjan." wrote:
[color=blue]
> =?Utf-8?B?VGlt?= wrote on 03 okt 2005 in
> microsoft.public.inetserver.asp.general:
>[color=green]
> >
> > "Evertjan." wrote:[color=darkred]
> >> Response.AddHeader "Content-Type", "image/Jpeg"
> >>[/color][/color]
>[color=green]
> > 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.[/color]
>
> With the right "Content-Type" it should.
>
> <http://reliableanswers.com/contenttype/CType.asp>
>
> --
> Evertjan.
> The Netherlands.
> (Replace all crosses with dots in my emailaddress)
>
>[/color]
Closed Thread


Similar ASP / Active Server Pages bytes