jmolleur Posted July 18, 2006 Share Posted July 18, 2006 I can load a blob field to a MySQL database, but I get a size restriction. I use the following code: $binFile = $uploadfile; $imgLocation = str_replace("\\","/", $binFile); $handle = fopen($binFile, "rb"); $data=addslashes(fread($handle, filesize($binFile))); $strDescription = addslashes(nl2br($txtDescription)); mysql_connect($database, $username, $password); @mysql_select_db($database) or die("Unable to select database"); $query="Update contacts set Tif_file='$data', email='test2', fname='$basefilename' where first = 'Alexa'"; if (mysql_query($query)) { echo "Successful write<br>"; } else { echo "Failed write<br>"; echo mysql_errno() . ": " . mysql_error() . "<br>"; }fclose($handle);For small files, it uploads perfectly. For larger files, it fails. I think I can change the parameter on MySQL to allow a bigger file to be uploaded to the blob field. So, I tried to upload the bigger files to SQL Server 2000 instead of MySQL. I can't upload those files because it would fail each time it encountered an apostrophe. I can't change the apostrophe to another character because it's a TIF file that I'm trying to upload. I used the same file to upload to the SQL Server 2000 database as I used to upload to the MySQL.Anyone have any success uploading big files to SQL Server using php? I used to do it in VB - I loaded the tif into a stream and then put it in the file. Anyone have any source code to do this?THanks! Quote Link to comment https://forums.phpfreaks.com/topic/14973-load-blob-field-to-sql-server/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.