---
title: "Spara fil i mapp med uppladdningsscript"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/165642-spara-fil-i-mapp-med-uppladdningsscript"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Trumpf"
published: "2007-10-19T11:26:02.000Z"
updated: "2007-10-19T12:01:35.000Z"
replies: 2
views: 629
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/165642-spara-fil-i-mapp-med-uppladdningsscript"
---

# Spara fil i mapp med uppladdningsscript

## #1 — Trumpf, 2007-10-19T11:26Z

Om jag vill spara filen jag laddar upp i en mapp exempel filer var ändrar jag på det?

```
<%
Response.Expires=0
Response.Buffer = TRUE
Response.Clear
'Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))
byteCount = Request.TotalBytes
'Response.BinaryWrite(Request.BinaryRead(varByteCount))

RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")

BuildUploadRequest RequestBin

'Exempel på hur man kan 'plocka ner' andra forumlärelement
'email = UploadRequest.Item("email").Item("Value")

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

'Create FileSytemObject Component
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")

'Create and Write to a File
pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
' Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&filename)
Set MyFile = ScriptObject.CreateTextFile(Server.mappath(filename))

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

MyFile.Close

response.write "<b>Filens sökväg:</b> " & Server.mappath(filename) & "<br>"
response.write "<b>Filnamn:</b> " & filename & "<br><br>"
response.write "<img src=""" & filename & """>"
%>
```

Tacksam för svar. Nu sparas filen i rooten så säga.

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

## #2 — voigtann1, 2007-10-19T11:27Z

```
Set MyFile = ScriptObject.CreateTextFile(Server.mappath([b]"minmapp/" &[/b] filename))
```

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

## #3 — OveRRidE, 2007-10-19T12:01Z

Dessa två inlägg flyttades från tråden i ASP - Script-forumet, och blev en egen tråd, då scripten inte diskuteras i just de aktuella script-trådarna. 

MVH
OveRRidE, moderator

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/165642-spara-fil-i-mapp-med-uppladdningsscript
