Dowload file with different name from server

MisterB

Newcomer
Joined
Oct 18, 2005
Messages
17
Location
The Hague, The Netherlands
Hi All,

I've got a question,

I've created a upload page with which I'm able to upload file to my server.
When a file is uploaded it get a random filename on the server preventing that user get the error file allready exists.

In a DB I've stored the original name of the file.

Is there a way I can change the name of the download file for teh user
eg.

I upload a file called "this is an example.doc" it will be stored at the server as "jbytbxtwra436qwvyuxas564eq7wvf7q9xwe .doc"
Now when the user downloads the file I want it to be called "this is an example.doc" again..

is this posible??

Tnx!

Mrb
 
dawn!! afer seaching the internet for one hour and not finding anything usefull and after posting this thread.. I found what I was looking for...

and it's quite simple to...
VB.NET
Code:
Dim Filename As String
        Filename = "YG67S3797XHIHRWKS3J4WN8PQ9AY4I75WICJ862E.doc"
        Response.ContentType = "application/vnd.ms-word"

        Response.AppendHeader("Content-Disposition", "attachment; filename=this is an example.doc")
        Response.WriteFile(Server.MapPath("~/UploadFolder/" + Filename))
        Response.Flush()

Other Content Types:
vnd.ms-excel - For Excel
vnd.ms-powerpoint - For PowerPoint
vnd.ms-project - For Microsoft Project
pdf - For Adobe Acrobat Documents
rtf - For Rick Text Documents
vnd.lotus-wordpro - For WordPro
vnd.lotus-1-2-3 - For Lotus 1-2-3
vnd.visio - For Visio
jpeg - for JPG Image File
gif - for GIF Image File
png - for PNG Image File

Cheers
MrB
 
Back
Top