ShadowUploader - inserting uploaded images names to database
Discuss ShadowUploader - inserting uploaded images names to database in the ASP Development forum on ASP Free. ShadowUploader - inserting uploaded images names to database ASP Development forum discussing ASP related topics including coding practices, ASP tips, and more. Active Server Pages (ASP) enables you to empower your HTML pages dynamically with robust scripting options.
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.
Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.
Posts: 15
Time spent in forums: 4 h 29 m 7 sec
Reputation Power: 0
Ok after using what brains I have I managed to fix the upload problem.
A few questions before i burn my brain out.
I would like to do a database insert within this script, where is the best place to put it, I'd also like to include the name of the filename into the database.
Posts: 31,109
Time spent in forums: 3 Months 3 Weeks 2 Days 20 h 18 m 8 sec
Reputation Power: 2919
Quote:
Originally Posted by m27uk2000
Ok after using what brains I have I managed to fix the upload problem.
A few questions before i burn my brain out.
I would like to do a database insert within this script, where is the best place to put it, I'd also like to include the name of the filename into the database.
Thanks in advance.
have it in the loop over the uploaded files:
Code:
For x=0 To objUpload.FileCount-1
Response.Write("file name: "&objUpload.File(x).FileName&"<br />")
Response.Write("file type: "&objUpload.File(x).ContentType&"<br />")
Response.Write("file size: "&objUpload.File(x).Size&"<br />")
Response.Write("image width: "&objUpload.File(x).ImageWidth&"<br />")
Response.Write("image height: "&objUpload.File(x).ImageHeight&"<br />")
If (objUpload.File(x).ImageWidth>200) Or (objUpload.File(x).ImageHeight>200) Then
Response.Write("image to big, not saving!")
Else
Call objUpload.File(x).SaveToDisk(Server.MapPath("Uploads"), "")
Response.Write("file saved successfully!")
strSQL = "INSERT INTO MyTable (MyField, FileName, ...) VALUES ('somedata', '" & objUpload.File(x).FileName & "', ... )"
objConn.Execute(strSQL)
End If
Response.Write("<hr />")
Next
Posts: 1,217
Time spent in forums: 2 Weeks 6 Days 4 h 49 m 9 sec
Reputation Power: 33
I got that to work
just had to think about it for a second.
thanx
what i want to do though is write the pointer not just the file name so i'm going to try to add the path before that value somehow.
so i might ask you how to do that if i can't figure it out.
Posts: 31,109
Time spent in forums: 3 Months 3 Weeks 2 Days 20 h 18 m 8 sec
Reputation Power: 2919
Quote:
Originally Posted by JustXtreme
This is what i get
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/auditquery.asp, line 89
if this is line 89:
Code:
objConn.Execute(strSQL)
then you have to create something known as Connection Object - I assumed you're
familiar with this.
anyway, start learning about ASP and Database here: http://www.w3schools.com/asp/asp_ado.asp
Posts: 1,217
Time spent in forums: 2 Weeks 6 Days 4 h 49 m 9 sec
Reputation Power: 33
Thanx, im just trying to write the direct pointer so i can then use that for the image display. i have a few other pages i need to display this image.
Code:
Dim objUpload
If Request("action")="1" Then
Set objUpload=New ShadowUpload
If objUpload.GetError<>"" Then
Response.Write("sorry, could not upload: "&objUpload.GetError)
Else
Response.Write(" ")
'Response.Write("found "&objUpload.FileCount&" files...<br />")
'For x=0 To objUpload.FileCount-1
'Response.Write("file name: "&objUpload.File(x).FileName&"<br />")
'Response.Write("file type: "&objUpload.File(x).ContentType&"<br />")
'Response.Write("file size: "&objUpload.File(x).Size&"<br />")
'Response.Write("image width: "&objUpload.File(x).ImageWidth&"<br />")
'Response.Write("image height: "&objUpload.File(x).ImageHeight&"<br />")
If (objUpload.File(x).ImageWidth>768) Or (objUpload.File(x).ImageHeight>1024) Then
Response.Write("image to big, not saving!")
Else
Call objUpload.File(x).SaveToDisk(Server.MapPath("auditimages"), objUpload("name"))
Response.Write("<strong>file saved successfully!</strong><br><strong>Thank You, For Submitting A Picture For Refrence Number:</strong> "&objUpload("name"))
strSQL = "INSERT INTO auditimages (cnum, pointer) VALUES ('" & objUpload("name") & "','" & "/auditimages/" & objUpload("name") & "')"
sqlconnect.execute(strSQL)
End If
Response.Write("<br />")
End If
End If%><br />
<img src="ShowImage.asp?image=<%= objRS("pointer")%>" alt="Need To Upload Picture" width="225" height="150"border="0">
<img src="<%response.Write objRS("cnum")%>" alt="Need To Upload Picture" width="225" height="150"border="0">