---
title: "Ombyggnad till aspUpload"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/110369-ombyggnad-till-aspupload"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Asa"
published: "2004-08-30T14:55:55.000Z"
updated: "2004-08-30T14:55:55.000Z"
replies: 0
views: 208
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/110369-ombyggnad-till-aspupload"
---

# Ombyggnad till aspUpload

## #1 — Asa, 2004-08-30T14:55Z

Någon som kan hjälpa mig bygga om detta till aspupload?

```
<!--#Include file="function.asp"-->
<%byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Set UploadRequest = CreateObject("Scripting.Dictionary")

BuildUploadRequest RequestBin

contentType   = UploadRequest.Item("fil").Item("ContentType")
filepathname  = UploadRequest.Item("fil").Item("FileName")
filename      = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
value         = UploadRequest.Item("fil").Item("Value")
pdf           = "pdf/" & filename

' hämtar filextension 
extension = right(pdf,len(pdf) - instr(pdf,".") +1)

Filen = "pdf_" & Request.Querystring("id")

' bygger ihop det nya filnamnet 
newfilename = Filen & extension 

Make_upload = False
Filetype           = lCase(right(Filename, len(Filename)-instrRev(Filename,".")))
Select Case Filetype
  Case "pdf"
    Make_upload = True
End Select

If Make_upload = True Then
  Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
  pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
  Set MyFile = ScriptObject.CreateTextFile(Server.mappath("../pdf/"& newfilename))

  For i = 1 to LenB(value)
     MyFile.Write chr(AscB(MidB(value,i,1)))
  Next
  MyFile.Close

  Conn.execute("Update artiklar Set pdf1='pdf/" & newfilename & "'  Where id = "& Request.Querystring("id"))
  Response.Redirect "admin.asp?do=inne"
Else
  Response.Redirect "admin.asp?do=inne"
End If%>
```

Permalänk: https://www.webforum.nu/p/110369

---

Tråden på webben: https://www.webforum.nu/amne/asp/110369-ombyggnad-till-aspupload
