troubleshooting Question

Blob a uploaded file into SQL DB

Avatar of Steynsk
SteynskFlag for Netherlands asked on
13 Comments1 Solution480 ViewsLast Modified:
Hi experts,

I'm using this well working  jquery uploading script called uploadify. With the help of Big Monty and Scott Fell I succeeded in pasing true a value to a rename function.

But now I'd like to make the next step.

I'd like to store the file as a blob into my database.

Beneath the code I could think of my self but I can't figure out what my line 34 should end like.  I've put rem quotes for the benameing part. But unremarked this code does its job.

Can someone please help me out?  

	Public Sub Save(path)
		Dim streamFile, fileItem, filePath

		if Right(path, 1) <> "\" then path = path & "\"

		if not uploadedYet then Upload

		For Each fileItem In UploadedFiles.Items
			filePath = path & fileItem.FileName
			Set streamFile = Server.CreateObject("ADODB.Stream")
			streamFile.Type = adTypeBinary
			StreamRequest.CopyTo streamFile, fileItem.Length
			streamFile.SaveToFile filePath, adSaveCreateOverWrite
			Set streamFile = Nothing
			fileItem.Path = filePath
			'Dim fso, newFile, caseID
			'Set fso = CreateObject("Scripting.FileSystemObject")
			'uploadsDirVar = "C:\Inetpub\wwwroot\myweb\userfiles" 
			'caseID = Session("templateID")
			'newFile = uploadsDirVar&"\"& templateID & fileItem.FileName
			'fso.MoveFile filePath, newFile
			'set fso = nothing
			SQL = "SELECT * FROM myfiletable;"
			Set RS = Server.CreateObject("ADODB.RecordSet") 
			RS.Open SQL, CS, 1, 3 
			RS("filename") = fileItem.FileName
			RS("templateID") = Session("templateID")
			RS("ContentType") = fileItem.ContentType
			RS("file").AppendChunk ..............
	End Sub
Big Monty
Web Ninja at large

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros