---
title: "AspSmartUpload Script"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/91000-aspsmartupload-script"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "viki"
published: "2003-11-22T15:09:20.000Z"
updated: "2003-11-25T05:39:45.000Z"
replies: 10
views: 337
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/91000-aspsmartupload-script"
---

# AspSmartUpload Script

## #1 — viki, 2003-11-22T15:09Z

Jag undrar ifall nån har aspsmartupload script som sparar bilder i mappen, å filnamnet till databasen.
Min server stödjer aspsmartupload, men jag hittar ingen script till det...

cheers
:bire

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

## #2 — medialabs, 2003-11-22T15:30Z

<http://www.aspsmart.com/aspSmartUpload/> kanske?

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

## #3 — viki, 2003-11-23T01:26Z

..

japp, men jag kan inte få dem å funka, jag får objekt recuired

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

## #4 — @nders, 2003-11-23T01:35Z

Då vill vi se den kod du försöker med.

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

## #5 — viki, 2003-11-23T15:02Z

\<%
'  Variables
'  \*\*\*\*\*\*\*\*\*
   Dim mySmartUpload
   Dim intCount
        
'  Object creation
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Upload
'  \*\*\*\*\*\*
   mySmartUpload.Upload

'  Save the files with their original names in a virtual path of the web server
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   intCount = mySmartUpload.Save("bilder")
   ' sample with a physical path 
   ' intCount = mySmartUpload.Save("bild")

'  Display the number of files uploaded
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Response.Write(intCount & " file(s) uploaded.")
%\>
\<%
Set connect = Server.CreateObject("ADODB.Connection")
connect.Open("Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & Server.MapPath("data/community.mdb"))
Set RecSet = Server.CreateObject("adodb.recordset")
SQL = "SELECT \* FROM members"
set RS = Connection.Execute(SQL)
SQL = "UPDATE members Set bild = '"&File.FileName&"' where id ="&session("id")
Connection.Execute(SQL)
%\>

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

## #6 — @nders, 2003-11-23T15:09Z

Finn ett fel. ;)

```
Set [b]connect[/b] = Server.CreateObject("ADODB.Connection")
 . ..
[b]Connection[/b].Execute(SQL)
```

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

## #7 — viki, 2003-11-23T23:53Z

jag får endå object required... :(

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

## #8 — @nders, 2003-11-24T05:30Z

Visa kod och markera den kodrad som felmeddelandet pekar på.

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

## #9 — OveRRidE, 2003-11-24T09:04Z

> **viki skrev:**
>
> jag får endå object required... :(

Två rader ovanför det som @nders anmärkte på finns ett object som inte är instansierat.

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

## #10 — viki, 2003-11-24T23:22Z

jag fick tag på aspupload scriptet, men jag får en 
To few parameters exepted 1

line 42

koden ser ut såhär

\<%
'  Variables
'  \*\*\*\*\*\*\*\*\*
   Dim mySmartUpload
   Dim file
   Dim oConn
   Dim strSQL
   Dim oRs
   Dim intCount
   intCount=0
        
'  Object creation
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Upload
'  \*\*\*\*\*\*
   mySmartUpload.Upload
   
      
'  Save the files with their original names in a virtual path of the web server
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   intCount = mySmartUpload.Save("bilder")
   ' sample with a physical path 
   ' intCount = mySmartUpload.Save("c:\\temp\\")

'  Connect to the DB
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Set oConn = Server.CreateObject("ADODB.Connection")
   curDir = Server.MapPath("data\\community.mdb")
   oConn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (\*.mdb)};DriverId=25;FIL=MS Access;"

'  Open a recordset
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   strSQL = "SELECT FILENAME,Bild FROM Members"

   Set oRs = Server.CreateObject("ADODB.recordset")
   Set oRs.ActiveConnection = oConn
   oRs.Source = strSQL
   oRs.LockType = 3
   oRs.Open

'  Select each file
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   For each file In mySmartUpload.Files
   '  Only if the file exist
   '  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
      If not file.IsMissing Then

      '  Add the current file in a DB field
      '  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
         oRs.AddNew
         file.FileToField oRs.Fields("Bild")
		 oRs("FILENAME") = file.FileName
         oRs.Update
         intCount = intCount + 1
      End If
   Next

'  Display the number of files uploaded
'  \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
   Response.Write(intCount & " file(s) uploaded.\<BR\>")

'  Destruction
'  \*\*\*\*\*\*\*\*\*\*\*
   oRs.Close
   oConn.Close
   Set oRs = Nothing 
   Set oConn = Nothing 
%\>

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

## #11 — @nders, 2003-11-25T05:39Z

> **viki skrev:**
>
> jag fick tag på aspupload scriptet, men jag får en 
> To few parameters exepted 1

Felmeddelandet brukar betyda att man har stavat fel på ett tabell- eller fältnamn i sin SQL-fråga, dvs skrivit något som inte finns.

Använd gärna \[kod\]-taggar när du postar kod.

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/91000-aspsmartupload-script
