Here, I use this to upload to a MSSQL text field, can hold 3gb
//--------------------------------------------------------------file----------
$fileNameTemporaryS = $file;
$fileNameClientS = $file_name;
$fileSizeS = $file_size;
$fileTypeS = $file_type;
$fileNameClientS = str_replace(' ', '_', $fileNameClientS);
//
if ($file == "") {
echo ""; }
else {
//
$fd = fopen ($fileNameTemporaryS, 'r');
$sizeB = filesize ($fileNameTemporaryS);
$contB = fread ($fd, $size);
fclose ($fd);
$data = base64_encode($cont);
$fileencoded = chunk_split($data,20,'\'.\'');
}
//-----------------------------------------------------------------------------------
Then simply get a query to upload $data to your text field, you can also upload filesize, name and type information
This will upload any file, any format, it will Base64_encode it, and then put all the text in the field
This will download it again:
list( $data, $filename, $filetype, $filesize) = mssql_fetch_array( $result );
chunk_split($data,20,'\'.\'');
if ($filesize == "0"){echo"This file doesnt exist. <a href=\"javascript:history.go(-1)\">Back</a>";}
else{
header( "Content-length: $filesize" );
header( "Content-type: $filetype" );
header( "Content-Disposition: attachment; name=$filename" );
echo base64_decode($data);
}
mssql_close( $link );
exit;} ?>