webForumDet fria alternativet

ASPImage 2.0

6 svar · 516 visningar · startad av Salamana

SalamanaMedlem sedan mars 2005158 inlägg
#1

Jag ska göra så att man ska kunna ladda uppp bilder till ett konto som ligger på TDC. TDC använder sig av "ASPImage 2.0" och jag är inte faa... att hitta ett exempel för att se denna lilla kod..

Så nu undrar jag om det finns någon klippa här som kan ge mig denna kod..

Det jag ska göra är att endast ladda upp bilder rakt av med hjälp av "ASPImage 2.0"...behöver inte skala dem eller ngt sådant!!!

SNÄLLA....HJÄLP!!!

QuidMedlem sedan juni 20006 025 inlägg
#2

Om du endast ska ladda upp bilderna så föreslår jag att du använder en upload-komponent istället.

SalamanaMedlem sedan mars 2005158 inlägg
#3

OK... Men den komponenten måste väl installeras på servern...Eller??

SalamanaMedlem sedan mars 2005158 inlägg
#4

Nu såg jag även att dem har följande på servern:
FileUp Standard Edition 5.0.11 http://www.softartisans.com/

Är det ngt användbart till min uppladdning??

QuidMedlem sedan juni 20006 025 inlägg
#5

form.asp:

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

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

'--- Copyright (c) 2003 SoftArtisans, Inc.
'--- Mail: info@softartisans.com   http://www.softartisans.com
'-----------------------------------------------------------------------
%>

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

<BODY>
<p align=center>
<img src="/safileupsamples/fileupse.gif" alt="SoftArtisans FileUp">
</p>

<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 align=center WIDTH="600">
<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>
<tr>
<td colspan=2>
<hr noshade>
<b>Note:</b> This sample demonstrates how to perform a simple single file upload with FileUp
</td>
</tr>

</TABLE>
</FORM>

</BODY>
</HTML>

formresp.asp:

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

<HTML>
<HEAD>
<TITLE>SoftArtisans FileUp Upload Simple Sample</TITLE>
</HEAD>
<BODY>
<p>
<img src="/safileupsamples/fileupse.gif" alt="SoftArtisans FileUp">
</p>

<%
'-----------------------------------------------------------------------
'--- 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) 2003 SoftArtisans, Inc.
'--- Mail: info@softartisans.com   http://www.softartisans.com
'-----------------------------------------------------------------------

	'--- 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 IsObject(oFileUp.Form("myFile")) Then
		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()
			On Error Resume Next
				oFileUp.Form("myFile").Save
				If Err.Number <> 0 Then
					Response.Write "<B>An error occurred while saving the file</B><BR>" & _
									Err.Description & " (" & Err.Source & ")"
					Response.End
				End If
			On Error Goto 0

			'--- Display information about the saved file
			Response.Write "<H3>FileUp Saved the File Successfully</H3>"
			Response.Write "<DL>"
			
			'--- ServerName is the full path of the file as it was saved on the server
			Response.Write "<DT><B>Path on server</B></DT><DD>" & oFileUp.Form("myFile").ServerName & "</DD>"
			'--- UserFilename is the full path of the file as it was sent from the client
			Response.Write "<DT><B>Path on client</B></DT><DD>" & oFileUp.Form("myFile").UserFilename & "</DD>"
			'--- ShortFileName is just the Userfilename without the path
			Response.Write "<DT><B>Short filename</B></DT><DD>" & oFileUp.Form("myFile").ShortFilename & "</DD>"
			'--- TotalBytes is the byte size of the file
			Response.Write "<DT><B>Byte size</B></DT><DD>" & oFileUp.Form("myFile").TotalBytes & "</DD>"
			'--- ContentType is the mime type of the file. Eg, "application/msword"
			Response.Write "<DT><B>Content type</B></DT><DD>" & oFileUp.Form("myFile").ContentType & "</DD>"
			'--- CheckSum is the MD5 hash of the file that can be used to check file integrity
			Response.Write "<DT><B>CheckSum</B></DT><DD>" & oFileUp.Form("myFile").CheckSum & "</DD>"
			Response.Write "</DL>"
			
		Else
			Response.Write "There was no file submitted in the form field."
		End If
	Else
		Response.Write "The referenced field does not exist or is not of type=""file"""
	End If

	'--- Dereference FileUp
	Set oFileUp = Nothing
%>

</BODY>
</HTML>
SalamanaMedlem sedan mars 2005158 inlägg
#6

TACKAR FÖR HJÄLPEN!!!

SalamanaMedlem sedan mars 2005158 inlägg
#7

Nu har jag en fråga till gällande denna komponent..

Nu kör jag med följande för att det inte ska finnas flera med samma namn...

Select Case strExistAction			
	Case "AutoRename"
	oFileUp.CreateNewFile = True
	oFileUp.OverWriteFiles = False
End Select

Skriver man "oFileUp.Form("myFile")" så tar den rätt namn...men då blir det hela sökvägen....

Skriver man "oFileUp.Form("myFile").ShortFilename" så tar den det ursprungliga namnet...

Vad kan man skriva för att den ska ta det korrekta??????

135 ms totalt · 3 externa anrop · v20260731065814-full.beb2e261
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
132 ms — hämta tråd, inlägg och bilagor (db)