Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...