// Function Name : f_convert_file_to_blob
// Return Type : Blob
Integer li_FileNo
Integer li_Reads
Integer li_i
Integer li_value
Long ll_FileLen
Blob lblb_temp
String ls_docname
String ls_named
li_value = GetFileOpenName("Select File", ls_docname, ls_named, " ", "All Files (*.*), *.*")
If li_value <> 1 Then Return
li_FileNo = FileOpen(ls_docname, StreamMode!, Read!)
If li_FileNo < 0 Then Return
ll_FileLen = FileLength(ls_docname)
//////////////////////////////////////////////////////////////////////////////////////////
//Determine the number of reads required to read the entire file
//////////////////////////////////////////////////////////////////////////////////////////
If ll_FileLen > 32765 Then
If Mod(ll_FileLen, 32765) = 0 Then
li_Reads = ll_FileLen / 32765
Else
li_Reads = (ll_FileLen / 32765) + 1
End If
Else
li_Reads = 1
End If
For li_i = 1 To li_Reads
If FileRead(li_FileNo, lblb_temp) = -1 Then Return
ablb_data = ablb_data + lblb_temp
Next
FileClose(li_FileNo)
Return ablb_data
0 comments:
Post a Comment