My upload_max_filesize is 10M so I can expect the each avi file to be up to 10MB.
Is there settings I need to change in mysql? Increase the max table size or buffer size if there is one?
I can upload picture (jpg, gif) files alright but not avi files. Can anyone help me please 🙁 Thanks!
This is part of the code in the submit form:
<tr>
<td>Movie attachment:</td>
<td><input type="hidden" name="MAX_FILE_SIZE" value="10000000"><input name="movie" type="file" size="70"> (avi,gif)
</td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Upload movie"></td>
</tr>
</table>
This is part of the code to get the form vars:
// try to find demo's information
$movie = $HTTP_POST_FILES['movie']['tmp_name'];
$filename = addslashes($HTTP_POST_FILES['movie']['name']);
$filesize = addslashes($HTTP_POST_FILES['movie']['size']);
$filetype = addslashes($HTTP_POST_FILES['movie']['type']);
if (upload_movie($movie, $filename, $filesize, $filetype, $pid, $valid_user))
echo "Movie uploaded.";
else
echo "Could not upload movie. ";
And this is the function "upload_movie" that executes the sql command:
function upload_movie($movie, $filename, $filesize, $filetype, $pid, $valid_user)
{
// Add movie to the database
if (!($conn = db_connect()))
return false;
$movieBinary = addslashes(fread(fopen($movie, "r"),10000000));
if (!mysql_query( "insert into demos (username, pid, movieBinary, filename, filesize, filetype) values ('$username', '$pid', '$movieBinary', '$filename', '$filesize', '$filetype')"))
return "Could not add demo in database - please try again later.";
return true;
}