Products
Services
Contact Us

Scripts: asp :: ASP File System :: Library Article #8

Developer's Section

Upload a File using AspUpload - Persists.Upload
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating:  | Rate It:   
Average Votes: (5894)
Favorites:

Learn to upload a file using the AspUpload Object

To upload a file using Persists.Upload.1 Object your server must have installed the ASPUploadObject on the server.

Upload an Image file using SaveAs Method:
If you need to have control over which name to give the file once you upload it to the server you can create the following routine to accomplish just that:

 Code Snippet 1

<%

'upload images to server

Server.ScriptTimeout = 3600

Set Upload = Server.CreateObject("Persits.Upload.1")

Upload.OverwriteFiles = True

Dim dirpath

dirpath = server.mappath("/images/")

Count = Upload.Save(dirpath)

'retrieve image id from a form
imgID  = Upload.Form("imgID")



For Each Arq In Upload.Files


if Arq.Ext = ".jpg" OR Arq.Ext = ".gif"  then


' === RENAME IMAGE ===

Arq.SaveAs(dirpath & "\" & imgID & "sm" & Arq.Ext )

else
er = "There was an error Upload Image"
        Response.Write er
end if

Response.write "Upload image Successfull"

Next
%>


See other Scripts in ASP File System

Submit Your Scripts:

If you would like to have your ASP & ASP.NET scripts published in this section please fill out
the form below:
*Your Name or Username:
Home Town:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]