webForumDet fria alternativet

Från aspsmartupload till SAFileUp

ASP

7 svar · 246 visningar · startad av Rodan

Medlem sedan juli 20021 523 inlägg
Frågan#1

Hej

Jag har skaffat webbhotell... och dom stöder inte aspsmart upload..
så jag undrar om nån skulle fixa koden så att den passar deras upload komponent SAFileUp...

MVH/Rodan

-----------------------------------------------------------------------------------
KODEN
-----------------------------------------------------------------------------------

   On Error Resume Next 
 
   Dim mySmartUpload 
   Dim intCount 
   Dim file
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload") 
   mySmartUpload.AllowedFilesList = "gif,jpg,jpeg" 
   mySmartUpload.DenyPhysicalPath = True 
   mySmartUpload.MaxFileSize = 400000 
   mySmartUpload.TotalMaxFileSize = 400000 
 
   mySmartUpload.Upload 
   
For each file In mySmartUpload.Files        
 If not file.IsMissing Then      
    
    file.SaveAs("user_photo/" & Session("id") &".jpg")       
    intCount = intCount + 1 

    Set Connect = Server.CreateObject("ADODB.Connection") 
    Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("databas")&";pwd=lösen"

Set RecSet = Server.CreateObject("ADODB.Recordset")

Addera = "Select * From members Where id=" &Session("id")
RecSet.Open Addera, Connect, adOpenStatic, adLockOptimistic

RecSet("bild") = "user_photo/" & Session("id") &".jpg"
RecSet.Update

'If Err Then 
Response.Write("<b>Fel : </b>" & Err.description) 

End If
Next

RecSet.Close
Connect.Close
Set RecSet = nothing
Set Connect = nothing

Response.Redirect "installningar.asp"

-----------------------------------------------------------------------------------

Medlem sedan juli 20021 523 inlägg
#2

nån ?

Medlem sedan mars 20015 287 inlägg
#3

Finns det ingen hjälpsida hos ditt hotell? Eller länk till tillverkarens hemsida/FAQ?

Medlem sedan juli 20021 523 inlägg
#4

är det ingen som har jobbat med SAFileUp? för jag behöver det verkligen, det är ett extremt behov av detta...

Medlem sedan feb. 200112 078 inlägg
#5

Tack Farbror Google! Du hittade det som ingen annan hittade igen! :D

http://support.softartisans.com/docs/FileUpV4/

Medlem sedan feb. 200112 078 inlägg
#6

Titta, det fanns till och med kodexempel.

<%@ Language=VBScript %>
<% Option Explicit 

'-----------------------------------------------------------------------
'--- FileUp Simple Upload Sample
'--- 
'--- This sample demonstrates how to perform a single file upload
'--- with FileUp

'--- Copyright (c) 2002 SoftArtisans, Inc.
'--- Mail: [email]info@softartisans.com[/email]   [url]http://www.softartisans.com[/url]
'-----------------------------------------------------------------------
%>

<HTML>
<HEAD>
<TITLE>SoftArtisans FileUp Simple Upload Sample</TITLE>
</HEAD>

<BODY>

<H3 ALIGN=center>FileUp Simple Upload Sample</H3>

<!--

Note: For any form uploading a file, the ENCTYPE="multipart/form-data" and 
METHOD="POST" attributes MUST be present

-->
<FORM ACTION="formresp.asp" ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST">
<TABLE WIDTH="100%">
<TR>
	<TD ALIGN="RIGHT" VALIGN="TOP">Enter Filename:</TD>

<!--
Note: Notice this form element is of TYPE="FILE"
-->	
	<TD ALIGN="LEFT"><INPUT TYPE="FILE" NAME="myFile"><BR>
	<I>Click "Browse" to select a file to upload</I>
	</TD>
</TR>
<TR>
	<TD ALIGN="RIGHT">&nbsp;</TD>
	<TD ALIGN="LEFT"><INPUT TYPE="SUBMIT" NAME="SUB1" VALUE="Upload File"></TD>
</TR>
</TABLE>
</FORM>

</BODY>
</HTML>
<%@ Language=VBScript %>
<% Option Explicit %>

<HTML>
<HEAD>
<TITLE>SoftArtisans FileUp Upload Simple Sample</TITLE>
</HEAD>
<BODY>

<%
'-----------------------------------------------------------------------
'--- FileUp Simple Upload Sample
'--- 
'--- This sample demonstrates how to perform a single file upload
'--- with FileUp

'--- This is the ASP form-response script that uses FileUp to receive and
'--- process the upload submitted from form.asp

'--- Copyright (c) 2002 SoftArtisans, Inc.
'--- Mail: [email]info@softartisans.com[/email]   [url]http://www.softartisans.com[/url]
'-----------------------------------------------------------------------

	'--- Declarations
	Dim oFileUp

	'--- Instantiate the FileUp object
	Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")

	'--- Set the Path property to the location you wish to
	'--- temporarily cache the incoming file before saving
	'--- Note: This property must be set immediately after
	'--- instantiating the FileUp object
	oFileUp.Path = Server.MapPath(Application("vroot") & "/temp")

	'--- Check to be sure there was a file selected in the form
	'--- If so, continue processing
	If Not oFileUp.Form("myFile").IsEmpty Then
	
		'--- Save the file
		'--- Note: The Save() method saves the file
		'--- with its original name to the directory
		'--- you set as the Path property.
		'--- To save a file to a different location
		'--- or with a different name, use the SaveAs() method
		'--- instead of Save()
		oFileUp.Form("myFile").Save

		'--- The file is saved, display a confirmation message
		Response.Write("<B>File saved successfully on the server as:</B><BR>")

		'--- The ServerName() property is the full path of the file
		'--- where it was saved on the server
		Response.Write(oFileUp.Form("myFile").ServerName)
		
	Else
		Response.Write("Error: There was no file submitted for upload.")
	End If

	'--- Destroy objects
	Set oFileUp = Nothing
%>

</BODY>
</HTML>
Medlem sedan juli 20021 523 inlägg
#7

nu har jag klagat på webhotellet :) och dom har fixat ASPupload , och JA, jag har läst artiklar men får det inte att funka så jag gav upp... det är samma kod men nu till ASPupload...

Medlem sedan mars 20015 287 inlägg
#8

Felmess?
Ta bort raden: On Error Resume Next

268 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
129 ms — deklarationer (db)
0 ms — hämta statistik (cache)
137 ms — hämta tråd, inlägg och bilagor (db)
129 ms — ändringar (db)