---
title: "ASP-Upload"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/139445-asp-upload"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "alle_nilsson"
published: "2005-12-16T14:46:45.000Z"
updated: "2005-12-19T17:40:12.000Z"
replies: 2
views: 344
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/139445-asp-upload"
---

# ASP-Upload

## #1 — alle_nilsson, 2005-12-16T14:46Z

Så har jag då äntligen fått ett enkelt uppladdningsscript att fungera! Tack för all hjälp här! Nu behövs mer tips... :OO 

Nedan är koden som fungerar för mig!

```
<%Set Upload = Server.CreateObject("Persits.Upload")

Upload.SetMaxSize 5000, True 

On Error Resume Next 

Count = Upload.Save("hemligt  ;) ") 

If Err.Number = 8 Then 
   Response.Write "Your file is too large. Please try again." 
Else 
   If Err <> 0 Then 
      Response.Write "An error occurred: " & Err.Description 
   Else 
      Response.Write "Success!" 
   End If 
End If 
%>
```

 

Försöker integrera nedanstående kod så att stopp för att filer skrivs över finns;

```
<%
Set Upload = Server.CreateObject("Persits.Upload")
' we use memory uploads, so we must limit file size
Upload.SetMaxSize 100000, True

' Save to memory. Path parameter is omitted
Upload.Save

' Check whether a file was selected
Set File = Upload.Files("FILE1")
If Not File Is Nothing Then
   ' Obtain file name
   Filename = file.Filename

   ' check if file exists in c:\upload under this name
   If Upload.FileExists("c:\upload\" & filename ) Then
      Response.Write "File with this name already exists."
   Else
      ' otherwise save file
      File.SaveAs "c:\upload\" & File.Filename
      Response.Write "File saved as " & File.Path
   End If
Else ' file not selected
   Response.Write "File not selected."
End If
%>
```

 

Men lyckas tyvärr inte...  :(

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

## #2 — M.Cheraghi, 2005-12-18T19:40Z

Och felmeddelandet lyder ungefär hurdå?

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

## #3 — freddssite, 2005-12-19T17:40Z

Lägg in denna kod

Upload.OverwriteFiles = False

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/139445-asp-upload
