jeudi 5 novembre 2015

PHP Uploading Module restricts filesize > 2 KB

I have my Upload File page written in HTML/PHP. The file's content gets stored in a Blob column of an Oracle table. The problem is that it only uploads file that is less than 2 KB and not the greator ones. The code is:

HTML:

Please specify your file: 

<input type="file" name="datafile" id = "datafile"/>
<br></br>
<input type="submit" id = "save" name = "save" value="Upload"/>

PHP:

if(isset($_POST['save']) && $_FILES['datafile']['size'] > 0)
{
$fileName = $_FILES['datafile']['name'];
$fileSize = $_FILES['datafile']['size'];
$tmpName  = $_FILES['datafile']['tmp_name'];
$fileType = $_FILES['datafile']['type'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp); 
$conn = OCILOGON("myDB","myDB","MYSERVER");
$qry = "INSERT INTO FilesTable (date_input,file_name,File_CONTENT) VALUES (SYSDATE,'$fileName',utl_raw.cast_to_raw('$content'))";


$stmt = OCIparse($conn,$qry);
ociexecute($stmt);

$result = oci_num_rows($stmt);

Problem:

Code only works for FileSize < 2 KB. Although I have upload_max_filesize = 2M in my phpinfo();

Aucun commentaire:

Enregistrer un commentaire