...

View Full Version : multiple file upload - modifications



jarv
04-15-2012, 05:05 PM
hi, I am about to use the multiple file upload: http://phpfileuploader.com/ There are a few issues I need to overcome...


I need to be able to resize to thumbs in a seperate folder called thumbs at 100px height
I'd like to rename my files with random numbers so I can upload same file name and it won't overwite?!
also, I'd like to INSERT EACH image I upload into a database


in my original code (single upload) I have resize to thumbs and insert in database:



resize("gallery/".$FileName, 100, "thumbs/".$FileName);

// Define $myusername and $mypassword
$UserID=$_POST['UserID'];
$PictureName=$_POST['PictureName'];
$PictureDate=$_POST['PictureDate'];
$TargetID=$_POST['TargetID'];

// To protect MySQL injection (more detail about MySQL injection)
$UserID = stripslashes($UserID);
$PictureName = stripslashes($PictureName);
$PictureDate = stripslashes($PictureDate);
$TargetID = stripslashes($TargetID);
$UserID = mysql_real_escape_string($UserID);
$PictureName = mysql_real_escape_string($PictureName);
$PictureDate = mysql_real_escape_string($PictureDate);
$TargetID = mysql_real_escape_string($TargetID);


$sql = "INSERT INTO rstargetpictures (UserID, FileName, PictureName, PictureDate, TargetID)
VALUES ('$UserID', '$FileName', '$PictureName', '$PictureDate', '$TargetID')";
$msg = "New booking added";
$result = mysql_query($sql) or die('Error: ' . mysql_error() . '<br>SQL: ' . $sql);



the code for the multiple uploader is too long, it's in OOPHP too!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum