This topic is locked

UPLODE File with Microsoft Access

5/8/2004 1:58:42 AM
ASPRunnerPro General questions
Pfeiffer author

Hello,

if I use the uploder from ASP Runner for an EXCEL-document to save a document in my MySQL-Database i have no problemes if I later want to read the BLOB-File by clicking on the image in ASP Runner . Works great !!!
If I upload the same file using Visual Basic from Microsoft Access 2000 (the MySQL-Table is linked) with the appendchunk-method (READBLOB function published from Microsoft in the knowledge database) ASP Runner will open the document by clicking on the picture, but the document is broken and for exampke EXCEL can' t read it any more.
So I Think, that ASP-Runner does something special with the uploaded file that the normal VB-funtion appendchunk doesn't do.
What's the difference between the two methods. Can you send me some code in VB (Access 2000) to upload/download Files properly in the format of ASP-Runner or explain the difference.
Here my Source-Code

--------------------------------------------------------------------------------------

Function Einlagern_Dokument ()
Const BlockSize = 32768

Dim Bezeichnung As String

Dim EXCEL_Datei As String

Dim NumBlocks As Integer, SourceFile As Integer, i As Integer

Dim FileLength As Long, LeftOver As Long

Dim FileData As String

Dim RetVal As Variant
Dim rst As Recordset

Set rst = CurrentDb.OpenRecordset("Dokumentenverwaltung")
With rst

.AddNew

![Dateiname] = "WG_Statistik.xls" ' für den Linkaufruf in ASP-Runner
EXCEL_Datei = "D:\Jobs\WG_Statistik\Output\Job_010\Auswertung.XLS
' Dokument einlesen

SourceFile = FreeFile

Open EXCEL_Datei For Binary Access Read As SourceFile
' Get the length of the file.

FileLength = LOF(SourceFile)

If FileLength > 0 Then

' Calculate the number of blocks to read and leftover bytes.

NumBlocks = FileLength \ BlockSize

LeftOver = FileLength Mod BlockSize
' Read the leftover data, writing it to the table.

FileData = String$(LeftOver, 32)

Get SourceFile, , FileData

![Dokument].AppendChunk (FileData)
' Read the remaining blocks of data, writing them to the table.

FileData = String$(BlockSize, 32)

For i = 1 To NumBlocks

Get SourceFile, , FileData

![Dokument].AppendChunk (FileData)

Next i

End If
' Textbezeichnung des Files

![Bezeichnung] = "egal"
.Update
End With
rst.Close
End Function

-------------------------------------------------------------------------------------
Thank you very much.

Greetings
Uwe Pfeiffer

Sergey Kornilov admin 5/9/2004

Uwe,
ASPRunner don't do anything special when it uploads files to the database. Upload routine is exactly the same for all databases and can be found in include/clsField.asp and include/clsUpload.asp files.
Let's do the following: create a sample Excel file, upload it to the database using your code and save it to another file by clicking on file picture in ASP code generated by ASPRunner. Send both files to support AT xlinesoft.com for investigation.