Print Page | Close Window

how do you use ASP Upload?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=2631
Printed Date: 29 March 2026 at 7:39pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: how do you use ASP Upload?
Posted By: Scotty32
Subject: how do you use ASP Upload?
Date Posted: 12 May 2003 at 7:05am

i posted about this before: http://forums.webwiz.net/forum_posts.asp?TID=1866&KW=scotty%5F32 - http://forums.webwiz.net/forum_posts.asp?TID=1866&KW=scotty%5F32

but it doesnt want to work i cant get the values from the Form

its becose of the " ENCTYPE="multipart/form-data" "

i dont get it, because i want to add it some info to a database, and then upload a picutre and put the name from one of the form fields, but i cant get any values, anyone know how i can do this?

or does anyone know wot other upload components FastHosts have, that i could use?




Replies:
Posted By: WebWiz-Bruce
Date Posted: 12 May 2003 at 7:30am

Have a look on Persits web site who make ASpUpload they have loads of samples on there on how to use the component, a search on google will find their site.

When using the component you can't use Request.Form to get the values from other text fileds in the form, instead you get these values using the upload component. But if you have a llok at the samples on Persits web site it has it all there.

Fasthosts don't support any other upload components.



-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: Scotty32
Date Posted: 12 May 2003 at 8:39am

i have looked on there site (aspupload.com or sumfin) but i cant get it workin the example they have

i am using the "upload.form("field")" and thats wot i cant get the value from, the only way i can get a value is gettin rid of the ASP Upload component and usin the Request.Form - but that isnt helpfull as i wanna upload a picture if ya click on my past post, you'll see i put a link to the example am tryna use/edit

it works if i dont touch it, but it doesnt help, cose i wanna upload more then 1 picture, and i want sum of the pictures to go into a different folder



Posted By: ultramods
Date Posted: 12 May 2003 at 8:51am

Heres a sample piece of code which i use to get form details.

<%

Dim make, model


For Each Item in Upload.Form

IF Item.Name = "make" THEN
 make = Item.Value
END IF

IF Item.Name = "model" THEN
 model = Item.Value
END IF

NEXT

%>



Posted By: Scotty32
Date Posted: 12 May 2003 at 9:03am

 nope that dont work, soz

shouldnt this work thought?

Page1:

<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="page2.asp">

<INPUT TYPE=TEXT NAME="field">

<INPUT TYPE=SUBMIT VALUE="Submit">

</form>

Page 2:

<% Set Upload = Server.CreateObject("Persits.Upload.1") %>

<%=upload.form("field") %>

<% set Upload = nothing %>

shouldnt that work thought? but it doesnt

or have a just done it all wrong



Posted By: ultramods
Date Posted: 12 May 2003 at 9:09am
what error did you get when you tried the method i gave you. If i remember correclty you have to run that code after the pics have been entered into the directory. I haven't used your method so not sure


Posted By: Scotty32
Date Posted: 12 May 2003 at 10:41am

no, at the moment am tryin to get a value from a normal text field,

when ive done that, am goin to add the code to upload the pictures, i have that but i made a new page so i could get it to retreve the values

i dont get errors.... it just doesnt show any text

like i'll put "text = <% = upload.form("field")" but all i get in the page is "text ="

its like i left the field blank ( i didnt, and i have got it the right name and everyfin)

any ideas?



Posted By: ultramods
Date Posted: 12 May 2003 at 10:46am
Try saving the pics first then try retrieving the form data using the method I gave you.


Posted By: Scotty32
Date Posted: 12 May 2003 at 12:17pm

thanks ultramods - i didnt save the pics b4 accessin the database, it kinda works now, but i have a new error

Response object error 'ASP 0185 : 80020003'

Missing Default Property

/admin/skins/add-process3.asp, line 0

A default property was not found for the object.

it uploads the pic to my tempery place, but i get this error when i try to move it, well i dunno when i get it, as i dont have a Line 0... do i?



Posted By: ultramods
Date Posted: 12 May 2003 at 12:20pm
Why are you moving the the picture from one directory to another?


Posted By: Scotty32
Date Posted: 12 May 2003 at 12:26pm

 becose thats wot they do: http://www.aspupload.com/codesample.html - http://www.aspupload.com/codesample.html

also i want the images to go to a folder like

"/images/ < name from a field > / < image name >"

and am also movin them becose i dont want them ALL in this folder, i want to move sum to sumwhere else - and i cant upload the files after ive made the folder, becose then i'll be back to not bein able to get a value



Posted By: abulhallaj
Date Posted: 15 May 2003 at 9:20am

Here I have some source code that you can change it for your own perpose:

<%
Response.Buffer = true
Function BuildUpload(RequestBin)
     'Get the boundary
     PosBeg = 1
     PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
     boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
     boundaryPos = InstrB(1,RequestBin,boundary)
     'Get all data inside the boundaries
     Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
          'Members variable of objects are put in a dictionary object
          Dim UploadControl
          Set UploadControl = CreateObject("Scripting.Dictionary")
          'Get an object name
          Pos = InstrB(BoundaryPos,RequestBin,getByteString("Content-Disposition"))
          Pos = InstrB(Pos,RequestBin,getByteString("name="))
          PosBeg = Pos+6
          PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
          Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
          PosFile = InstrB(BoundaryPos,RequestBin,getByteString("filename="))
          PosBound = InstrB(PosEnd,RequestBin,boundary)
          'Test if object is of file type
          If PosFile<>0 AND (PosFile<PosBound) Then
               'Get Filename, content-type and content of file
               PosBeg = PosFile + 10
               PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
               FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
               'Add filename to dictionary object
               UploadControl.Add "FileName", FileName
               Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
               PosBeg = Pos+14
               PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
               'Add content-type to dictionary object
               ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
               UploadControl.Add "ContentType",ContentType
               'Get content of object
               PosBeg = PosEnd+4
               PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
               Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
               Else
               'Get content of object
               Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
               PosBeg = Pos+4
               PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
               Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
          End If
          UploadControl.Add "Value" , Value    
          UploadRequest.Add name, UploadControl    
          BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
     Loop
End Function

Function getByteString(StringStr)
     For i = 1 to Len(StringStr)
          char = Mid(StringStr,i,1)
          getByteString = getByteString & chrB(AscB(char))
     Next
End Function

Function getString(StringBin)
     getString =""
     For intCount = 1 to LenB(StringBin)
          getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
     Next
End Function

If request("Action")="1" then
     Response.Clear
     byteCount = Request.TotalBytes
    
     RequestBin = Request.BinaryRead(byteCount)
    
     Set UploadRequest = CreateObject("Scripting.Dictionary")

     BuildUpload(RequestBin)
    
     If UploadRequest.Item("blob").Item("Value") <> "" Then

          contentType = UploadRequest.Item("blob").Item("ContentType")
          filepathname = UploadRequest.Item("blob").Item("FileName")
          filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
          FolderName = UploadRequest.Item("where").Item("Value")
          Path = Mid(Request.ServerVariables("PATH_TRANSLATED"), 1, Len(Request.ServerVariables("PATH_TRANSLATED")) - Len(Request.ServerVariables("PATH_INFO"))) & "\"
          ToFolder = Path & "\" & FolderName
          value = UploadRequest.Item("blob").Item("Value")
          filename = ToFolder & "\" & filename
          Set MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
          Set objFile = MyFileObject.CreateTextFile(filename)
                    




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net