---
title: "ladda upp fil"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/12265-ladda-upp-fil"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "soffan76"
published: "2001-10-24T10:30:00.000Z"
updated: "2001-10-24T13:38:00.000Z"
replies: 3
views: 140
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/12265-ladda-upp-fil"
---

# ladda upp fil

## #1 — soffan76, 2001-10-24T10:30Z

Hej alla!

Jag har hittat denna lilla kodsnutt för att ladda upp bilder utan komponent. Problemet är att jag inte förstår var man ändrar sökvägen till mappen där bilden ska läggas.
Nån som ser var detta sker?

```
<%
' Author Philippe Collignon

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

'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)&"uploaded"&filename)
 
 For i = 1 to LenB(value)
	 MyFile.Write chr(AscB(MidB(value,i,1)))
 Next
 
 MyFile.Close
%>
<b>Uploaded file : </b><%="uploaded"&filename%><BR>
<img src="<%="uploaded"&filename%>">
<!--#include file="upload.asp"-->
```

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

## #2 — PatrikB, 2001-10-24T11:21Z

Den fetmarkerade raden är den som bestämmer vart filen ska sparas:

```
<%
' Author Philippe Collignon
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

'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([b]"SÖKVÄGEN TILL MIN FIL"[/b])

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

MyFile.Close
%>
<b>Uploaded file : </b><%="uploaded"&filename%><BR>
<img src="<%="uploaded"&filename%>">
<!--#include file="upload.asp"-->
```

cya,
PatrikB

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

## #3 — soffan76, 2001-10-24T11:30Z

OK, tack, jag testar!

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

## #4 — Hallgren, 2001-10-24T13:38Z

Fungerade det?

Är själv ute efter ett sånt skript. :)

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/12265-ladda-upp-fil
