100 Web Space
http://forum.100webspace.com/

Problem Uploading files to Database
http://forum.100webspace.com/viewtopic.php?f=5&t=6673
Page 1 of 1

Author:  frogmen [ Fri May 11, 2007 10:09 pm ]
Post subject:  Problem Uploading files to Database

Hello, I'm trying to upload some files for my installation of phpbb XS2 forum to my sql database, I already do it once a while ago, but silly me, I don´t remember :oops:

pls any help, thks :lol:

rgds
Frogmen

Author:  scragar [ Sat Jul 07, 2007 2:33 am ]
Post subject: 

upload form:
Code:
<form id="Upload" action="upload.php" enctype="multipart/form-data" method="post">
<p>
<label for="file">File to upload:</label>
<input id="file" type="file" name="file">
</p>
<p>
<label for="submit">Press to...</label>
<input id="submit" type="submit" name="submit" value="Upload me!">
</p>
</form>

Upload page:
Code:
<?
$errors = array(1 => 'php.ini max file size exceeded',
                2 => 'html form max file size exceeded',
                3 => 'file upload was only partial',
                4 => 'no file was attached');
isset($_POST['submit'])
    or error('the upload form is neaded');
($_FILES[$fieldname]['error'] == 0)
    or error($errors[$_FILES['file']['error']]);
@is_uploaded_file($_FILES['file']['tmp_name'])
    or error('not an HTTP upload');

/**************************************************
*     now we have the file without errors we can      *
*       moveit to a new directory using the               *
*                       move_uploaded_file                     *
*         function, orif you want you could add it        *
*            to a DB if the configs already done.....     *
*************************************************/

$my_file = fopen($_FILES['file']['tmp_name'], 'r');
$contents = fread($my_file, filesize($_FILES['file']['tmp_name']));
fclose($my_file);

mysql_query("INSERT INTO DBfiles(id, name, contents)
                  VALUES('','"
               ,basename($_FILES['file']['tmp_name'])
               ."', '".str_replace("'", "\\"."'", $contents)."');");
?>
if you want more info let me know.

Author:  desta [ Wed Sep 26, 2007 8:22 am ]
Post subject: 

Hello, could you please help me, i'm a very very newbie here.

I made some file with using site builder wysiwyg web builder, and i'm so confuse how to upload it.

could you please help me where should i start.

thx
arie

Author:  james_ [ Wed Sep 26, 2007 10:29 am ]
Post subject: 

You can try to use your File Manager menu, which is very easy to use, or you can try yo upload your files via the FTP protocol.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/