Click to See Complete Forum and Search --> : image upload software
MTmace
04-05-2004, 05:05 PM
Is there software that allows users to upload images to the server?
I would like to use this for an admin section, so someone could upload images for a product and have that images be displayed with the product.
Thanks,
MTmace
PeOfEo
04-05-2004, 05:47 PM
I do not know if asp classic requires a third pary component or not, but I modified an asp.net file manager a guy I know made, and I made my own file uploading form as a sample a while back
http://quasi-ke.servebeer.com/sampleaps/upload.aspx
buntine mentioned this www.aspupload.com in another thread.
CardboardHammer
04-05-2004, 06:24 PM
Here's some source code for ASP.NET (old code (as evidenced by the lack of use of the codebehind file) I have lying around)(provided with no warranty of any sort, use at own peril, etc.):
<%@ Page Language="VB"
Explicit="True" %>
<HTML>
<script runat="server">
Sub UploadBtn_Click(Sender as Object, e as EventArgs)
Dim strFileName As String
Dim strFilePath As String
Dim strPass As String
Dim lngLength As Long
lngLength = MyFile.PostedFile.ContentLength
strPass = "WHATEVER YOU WANT..."
If StrComp(txtPwd.Text, strPass, 0) <> 0 Then
FileName.InnerHtml = "File not saved, invalid password!"
Else
strFilePath = "DIRECT_PATH_TO_THE_WEB_GOES_HERE\THIS_IS_THE_SUBDIRECTORY_FOR_THE_FILES_TO_BE_UPLOADED_TO\"
strFileName = MyFile.PostedFile.FileName
strFileName = Right(strFileName, strFileName.length() - InStrRev(strFileName, "\"))
If lngLength > 1024000000 Then
FileName.InnerHtml = "File not saved, too big."
Else
' Display information about posted file
'FileName.InnerHtml = MyFile.PostedFile.FileName
FileName.InnerHtml = strFileName
' Save uploaded file to server
MyFile.PostedFile.SaveAs(strFilePath & strFileName)
End If
End If
MyContentType.InnerHtml = MyFile.PostedFile.ContentType
ContentLength.InnerHtml = cStr(lngLength)
FileDetails.Visible = True
End Sub
</script>
<body>
<form id="Form1" action="fileupload.aspx" method="post" encType="multipart/form-data" runat="server">
<h1>ASP.NET File Upload Example</h1>
<P>Select File To Upload to Server: <input id="MyFile" type="file" name="MyFile" runat="server">
<br>
</P>
<asp:Label id="lblPwd" runat="server">Password: </asp:Label>
<asp:TextBox id="txtPwd" runat="server" MaxLength="50" TextMode="Password"></asp:TextBox>
<br>
<br>
<input type="submit" value="Upload!" OnServerclick="UploadBtn_Click" runat="server" ID="Submit1" NAME="Submit1">
<br>
<br>
<br>
<div id="FileDetails" Visible="false" runat="server">
FileName:
<span id="FileName" runat="server"></span><br>
ContentType:
<span id="MyContentType" runat="server"></span><br>
ContentLength:
<span id="ContentLength" runat="server">bytes</span>
<br>
</div>
</form>
</body>
</HTML>
PeOfEo
04-05-2004, 07:53 PM
http://quasi-ke.servebeer.com/sampleaps/upload.txt this is the source to the form I listed earlier. No password protection on it, you might choose to integrate logins with a session, infact http://www.webreference.com/programming/asp/quasi/ here is an article on logins I wrote :p
buntine
04-05-2004, 10:54 PM
Theres several third-party components which you can use in ASP. Persits ASPUpload being the most popular. If you are hosting your web site on a remote server, they may have a component installed already.
Regards,
Andrew Buntine.