It is currently Tue May 22, 2018 6:27 am


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Problem Uploading files to Database
PostPosted: Fri May 11, 2007 10:09 pm 
Noobie
Noobie

Joined: Thu Aug 10, 2006 6:09 pm
Posts: 16
Location: Palma de Mallorca
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 2:33 am 
Experienced
Experienced

Joined: Fri May 13, 2005 10:24 am
Posts: 54
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 8:22 am 
Noobie
Noobie

Joined: Wed Sep 26, 2007 8:01 am
Posts: 1
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 26, 2007 10:29 am 
Support Team Member

Joined: Wed Sep 19, 2007 8:17 am
Posts: 7
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.

_________________
Best Regards
James


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ]  Moderators: fhmagic, KJ, Support Team, Moderators

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
100WebSpace © 2011