Here is the code...
| From: | Anderson Sone | Date: | Thu, 24 May 2001 17:47:28 +0000 |
| Subject: | Here is the code... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9617@lists.php.net to get a copy of this message | ||
What´s wrong?
I did it, but only 4Kb was inserted in a field...
I used field like : NText, Text, Binary... in a Sql Server.
See the code :
__________________________________
<?
if ($action == "upload") {
$arquivo = str_replace("\\\\","\\",$arquivo);
// Faz UPLOAD
copy("$arquivo","$arquivo_name");
//Abre o arquivo
$data = fopen("$arquivo_name", "r");
//Le o conteudo do arquivo
$conteudo = fread($data,filesize("$arquivo_name"));
$conteudo = bin2hex ($conteudo);
$con = mssql_connect("SERVIDOR","sa","");
mssql_select_db("DB", $con);
$result = mssql_query ("INSERT INTO ARQUIVOS (ARQ_NOME,ARQ_DADOS)
VALUES ('$arquivo_name','$conteudo')","$con");
exit;
}
?>
<html>
<head>
<title>UPLOAD</title>
</head>
<body bgcolor=#Fge89j>
<br><br><br><br> <br><br><br><br>
<center>
<form action="upload.php3" method=POST enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="999999999">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<b>Arquivo.....: </b><input name="arquivo" type="file">
<input type="submit" value="Enviar">
</form>
</body>
</html>