---
title: "Kort fast pa Overrides skript...."
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/68932-kort-fast-pa-overrides-skript"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "crisse6"
published: "2003-02-21T04:35:39.000Z"
updated: "2003-02-25T00:08:17.000Z"
replies: 7
views: 320
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/68932-kort-fast-pa-overrides-skript"
---

# Kort fast pa Overrides skript....

## #1 — crisse6, 2003-02-21T04:35Z

Hej!

Antar att jag har kommit in i en brist pa aspkunskaper igen.. hehe... jaja, kanske inte... far iaf Object Required: " pa denna rad:
CatID = UploadRequest.Item("catID").Item("Value") varfor vet jag ej... sa har ser koden ut:

```
[red]
Response.Expires=0
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")
catID = UploadReqeust.Item("catID").Item("Value")
FileDesc = UploadRequest.Item("desc").Item("Value")
DT = Now()
scriptName = UploadRequest.Item("scriptName").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("/UploadedSkript/"& 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 & ""

strInsertFile = "INSERT INTO t_Files ([catID], [scriptName], [fileDesc], [dt], [downloaded], [fileURL], [byUser], [Controlled]) "&_
"VALUES("&catID&",'"&scriptName&"','"&FileDesc&"',#"&DT&"#,'0', "&filename&", 'crisse6',False)"
objConn.Execute(strInsertFile)
[/red]
```

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

## #2 — Palle, 2003-02-21T07:20Z

Finns form-fältet *catID* ??

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

## #3 — crisse6, 2003-02-22T03:35Z

Jupp

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

## #4 — jupiters, 2003-02-22T04:00Z

timmen är sen och jag har inte hållit på med asp-upload men,
vad gör egentligen:

BuildUploadRequest

rad 9

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

## #5 — solbulle, 2003-02-22T09:46Z

I formuläret, har du: enctype="multipart/form-data"?

Annars om du tar bort just den raden, hur går det då?

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

## #6 — crisse6, 2003-02-23T03:17Z

> **jupiters skrev:**
>
> timmen är sen och jag har inte hållit på med asp-upload men, 
> vad gör egentligen: 
> 
> BuildUploadRequest 
> 
> rad 9

den andrar nat med formularen sa det blir ratt eller nat ;), vet bara att man inte kan skriva request.form("namn") nar man kor sant tror jag? jaja, skitsam...

solbulle, har inte mojlighet att testa koden nu, sitter i Chicago... hehe..... men ska gora det nar jag kommer hem, om tva dagar... ville bara kolla om ni visste direkt ;) aterkommer!

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

## #7 — crisse6, 2003-02-24T23:10Z

sa har ser det ut nu:

```
[red]
<%@ LANGUAGE=VBSCRIPT %>
<% OPTION EXPLICIT %>
<% Response.Buffer = TRUE %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Laddar upp skript...</title>
</head>

<body>
<!--#include file="db_conn.asp" -->
<%
Dim objConn, byteCount, RequestBin, PosBeg, i, char, PosEnd
Dim boundary, boundaryPos, Pos, intCount, Name, PosFile, PosBound
Dim filename, contentType, value, filepathname
Response.Expires=0
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")
'catID = UploadReqeust.Item("catID").Item("Value")
FileDesc = UploadRequest.Item("desc").Item("Value")
DT = Now()
scriptName = UploadRequest.Item("scriptName").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("/UploadedSkript/"& 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 & ""

strInsertFile = "INSERT INTO t_Files ([catID], [scriptName], [fileDesc], [dt], [downloaded], [fileURL], [byUser], [Controlled]) "&_
"VALUES("&catID&",'"&scriptName&"','"&FileDesc&"',#"&DT&"#,'0', "&filename&", 'crisse6',False)"
objConn.Execute(strInsertFile)
%>
<!--#include file="inc_upload.asp"-->
</body>
</html>
[/red]
```

formularet pa sidan innan ser ut sa har:

```
[red]
<form method="post" action="outputfile.asp" enctype="multipart/form-data">
Välj ditt skript:<br>
<input type="file" name="blob"><br>
Namn på skriptet:<br>
<input type="text" name="scriptName"><br>
En kort beskrivning av skriptet:<br>
<textarea cols="16" rows="4"></textarea><br>
Välj kategori:<br>
<select name="catID">
<%
Do until rs.eof
response.write "<option value="""&rs("catID")&""">"&rs("catName")&"</option>"
rs.movenext
loop
%>
</select><br><br>
<input type="submit" value="Ladda upp, yo!">
</form>
[/red]
```

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

## #8 — solbulle, 2003-02-25T00:08Z

> \<textarea cols="16" rows="4"\>\</textarea\>

Inget namn?

> \<% OPTION EXPLICIT %\>

 
Det är många variabler du inte dimmar, tex alla formfält...

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/68932-kort-fast-pa-overrides-skript
