asp XUpload.ocx upload til php eller ?
Jeg har det her asp kode til at uploade billeder til min side men kan det bruges på php eller kender i andre gode alternativer ?<SCRIPT LANGUAGE="VBScript">
Sub Select_OnClick
UploadCtl.Select
End Sub
Sub Remove_OnClick
UploadCtl.RemoveHighlighted
End Sub
Sub RemoveAll_OnClick
UploadCtl.RemoveAll
End Sub
Sub Upload_OnClick
UploadCtl.Upload
End Sub
</SCRIPT>
<input type="hidden" name="MAX_FILE_SIZE" value="10000000000">
<OBJECT WIDTH=100% HEIGHT=200
ID="UploadCtl"
CLASSID="CLSID:E87F6C8E-16C0-11D3-BEF7-009027438003"
CODEBASE="XUpload.ocx">
<PARAM NAME="Server" VALUE="www.sidensnavn.dk">
<PARAM NAME="Script" VALUE="stien til upload.php?galleriID=<?PHP echo $galleriID; ?>">
<PARAM NAME="ViewServerReply" VALUE="false">
<PARAM NAME="EnablePopupMenu" VALUE="True">
<PARAM NAME="MaxFileSize" VALUE="1000000">
<PARAM NAME="MaxTotalSize" VALUE="50000000">
<PARAM NAME="MaxFileCount" VALUE="<?PHP echo $max; ?>>">
<PARAM NAME="Extensions" VALUE="gif,jpeg,jpg">
<PARAM NAME="Filter" VALUE="Billede filer (*.gif,*.jpg,*.jpeg)|*.gif;*.jpg;*.jpeg">
<PARAM NAME="Redirect" VALUE="True">
<PARAM NAME="RedirectURL" VALUE="<?PHP echo $siteurl;?>profil/billedegalleri/index.php">
</OBJECT>
<INPUT NAME="SELECT" TYPE=image src="<?PHP echo $siteurl;?>images/small_botton/find_billeder.jpg" width="101" height="15">
<INPUT NAME="REMOVE" TYPE=image src="<?PHP echo $siteurl;?>images/small_botton/fjern.jpg" width="101" height="15">
<INPUT NAME="REMOVEALL" TYPE=image src="<?PHP echo $siteurl;?>images/small_botton/fjern_alle.jpg" width="101" height="15">
<INPUT NAME="UPLOAD" TYPE=image src="<?PHP echo $siteurl;?>images/small_botton/tilfoj_billeder.jpg" width="101" height="15">
og her er upload.asp
<!--#include virtual="/secure/connection.asp"-->
<!--#include virtual="/secure/access.asp"-->
<% Session.LCID = 1030
' Create an instance of AspUpload object
Set Upload = Server.CreateObject("Persits.Upload")
' Capture uploaded file. Save returns the number of files uploaded
Upload.Save("stien/\billedegalleri")
For Each File in Upload.Files
' create instance of AspJpeg object
Set jpeg = Server.CreateObject("Persits.Jpeg")
'--------------------------------------------------------------------
'INSERT INTO DB START
'--------------------------------------------------------------------
SQL = "insert into billedegalleri (galleriID,billede,godkendt,dato) values('" & request.QueryString("galleriID") & "','','0','" & now() & "')"
Conn.execute(SQL)
SQL2 = "SELECT last_insert_id() FROM billedegalleri"
Set RS = Conn.Execute(SQL2)
nytID = RS(0)
'--------------------------------------------------------------------
'INSERT INTO DB END
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'CREATE THUMBNAIL START
'--------------------------------------------------------------------
' open uploaded file
jpeg.Open( File.Path )
'Resize thumbnail
jpeg.Width = "100"
'Set new height, preserve original width/height ratio on thumbnail.
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
'Set the quality.
jpeg.Quality = 80
SavePathThumbNail = "stien\billedegalleri\thumb\" & nytID
' AspJpeg always generates JPEG thumbnails regardless of original format.
' If the original file was not a JPEG, append .JPG extension.
If UCase(Right(SavePathThumbNail, 3)) <> "JPG" Then
SavePathThumbNail = SavePathThumbNail & ".jpg"
End If
jpeg.Save SavePathThumbNail
'--------------------------------------------------------------------
'CREATE THUMBNAIL END
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'CREATE WATERMARK START
'--------------------------------------------------------------------
' open uploaded file
jpeg.Open( File.Path )
'Resize watermark
jpeg.Width = "400"
'Set new height, preserve original width/height ratio on thumbnail.
jpeg.Height = jpeg.OriginalHeight * jpeg.Width / jpeg.OriginalWidth
'Set the quality.
jpeg.Quality = 80
SavePathWaterMark = "stien\billedegalleri\watermark\" & nytID
' AspJpeg always generates JPEG thumbnails regardless of original format.
' If the original file was not a JPEG, append .JPG extension.
If UCase(Right(SavePathWaterMark, 3)) <> "JPG" Then
SavePathWaterMark = SavePathWaterMark & ".jpg"
End If
' Open a logo file
Set Logo = Server.CreateObject("Persits.Jpeg")
LogoPath = "stien\images\logo.gif"
Logo.Open LogoPath
' Place logo on top of photo in upper-left corner
jpeg.DrawImage 0, 0, Logo, 1, &H000000, 0
jpeg.Save SavePathWaterMark
'--------------------------------------------------------------------
'CREATE WATERMARK END
'--------------------------------------------------------------------
'--------------------------------------------------------------------
'UPDATE DB START
'-------------------------------------------------------------------
SQL = "UPDATE billedegalleri SET billede = '" & nytID&".jpg' WHERE id = '" & nytID & "'"
Conn.execute(SQL)
'--------------------------------------------------------------------
'UPDATE DB END
'-------------------------------------------------------------------
'--------------------------------------------------------------------
'DELETE ORIGINAL FILE START
'--------------------------------------------------------------------
fil = "stien.dk/billedegalleri/" & File.ExtractFileName
set fso = server.createobject("scripting.filesystemobject")
fso.deletefile(fil)
'--------------------------------------------------------------------
'DELETE ORIGINAL FILE END
'--------------------------------------------------------------------
next
%>