Go Back   vBulletin Modification Discussions > Coding Discussions > PHP Discussions, Tutorials and Help
Home Register FAQ Members List Calendar Mark Forums Read
vBSEO Info Tags

About This Page: This is a discussion on giving space to users within the PHP Discussions, Tutorials and Help forums, part of the Coding Discussions category, at vBulletin Modification Discussions. what's the best way to let a user upload files on the server other than ftp, and it should be secure and for one specific person?


Reply
 
LinkBack Thread Tools
Old 01-05-2007, 05:54 PM   #1 (permalink)
Junior Member
 
Join Date: Jan 2007
Posts: 17
Kriza is on a distinguished road
iTrader: (0)
giving space to users

what's the best way to let a user upload files on the server other than ftp, and it should be secure and for one specific person?
Kriza is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links

Old 12-26-2007, 12:53 PM   #2 (permalink)
Junior Member
 
amenadiel's Avatar
 
Join Date: Dec 2007
Location: Santiago de Chile
Posts: 10
amenadiel is on a distinguished road
iTrader: (0)
Re: giving space to users

you could make a custom template in vBulletin, restrict to a specific usergroup membrecy, and upload the file using something like the script I use to upload images:

let's say your authorized usergroup is number 50.
Code:
$vb_usergroups = explode(",", $vbulletin->userinfo['membergroupids']);
if (in_array(50, $vb_usergroups)) 
{
//#############upload code##############
echo '<form name="form1" enctype="multipart/form-data" method="post" action="processFiles.php"><p>';

  $uploadNeed = 20;
  for($x=0;$x<$uploadNeed;$x++){

echo '<input name="uploadFile'.$x.'" size="60" type="file" id="uploadFile'.$x.'"></p>';
  }

echo '<p><input name="uploadNeed" type="hidden" value="20">
    <input type="submit" name="Submit" value="Submit">
  </p>
</form>';

} else {
die('Not allowed to see this section');
}
The upload code points to a file called "processFiles.php" which content should be something like

Code:
$uploadNeed = $_POST['uploadNeed'];
for($x=0;$x<$uploadNeed;$x++){
$file_name = $_FILES['uploadFile'. $x]['name'];
// strip file_name of slashes
$file_name = stripslashes($file_name);

$file_name = str_replace("'","",$file_name);
$file_name = str_replace(" ","_",$file_name);
$file_name=time().'_'.$file_name;
$copy = copy($_FILES['uploadFile'. $x]['tmp_name'],$file_name);
amenadiel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply
Tags: , ,





Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


A vBSkinworks Design Recoded By vBModder.
All Code Distributed On This Site is © 2006 by it's author.
Search Engine Optimization by vBSEO 3.1.0

All times are GMT -7. The time now is 04:18 AM.
Online Users 39
Registered 0
Guests 39
Members 3414
Active Members 190
Threads 1698
Posts 7159
Top poster: Code Monkey (2209)
Welcome to our newest member, iffishaikh
Most users ever online was 235, 04-11-2007 at 08:59 AM.
Speak Out! vBulletin gets the web talking!


vBulletin Setup SEO

vBulletin graphics resource images