// Editable variables
$full_path = "/home/httpd/html/pbreview.com/fpics/"; // full path to directory that you want to store the images in - directory must be CHMOD to 777
$filesize = "102400"; // this is the max file size that you'd like uploaded
// Initialize date and time variables
// These are inserted into the image URL to ensure unique names
$date = (date ("mdy")); // format looks like 121700 - Month, Day, Year
$time = (date ("His")); // format looks like 214521 - Hours, Minutes Seconds
// Check that the user has permission to post/upload
if ($bbuserid == 0)
{
eval("echo standarderror(\$bbtitle,\"".gettemplate("error_nop ermission")."\");");
exit;
}
if ($bbusername == "" || (isset($bbusername))==0)
{
$getusername=$DB_site->query_first("SELECT username FROM user WHERE userid=$bbuserid");
$username=$getusername[username];
$bbusername = $username;
}
else
{
$username = $bbusername;
}
// Check file size
if ($userfile_size > $filesize) {
print "<font face=\"arial\" size=\"-1\"><b>Your file is too large. Please <a href=\"javascript:history.back()\"><font color=\"#FF9900\">click here</font></a> to go back and try again.</b></font>";
exit;
}
// CHANGED HERE
if ($userfile_type == "image/gif" or $userfile_type == "image/pjpeg" or $userfile_type == "image/jpeg") {
// END CHANGED HERE
// Copy the uploaded file to the proper directory
if (copy ($userfile, "$full_path$username$date$time$userfile_name") ) {
// Initialize BBCode tags for use in the Image URL - I know this is a cheap way to do this, but I was rushing :-)
// Remove the temp file from the server
unlink ($userfile);
// Begin User Code Presentation Page
print "<font face=\"arial\" size=\"-1\"><b><p>Copy the following code (from [img] to [/img]) and insert it into your post:</p>";
print "<font face=\"arial\" size=\"-1\"><b><p><form><input type=\"text\" size=\"50\" value=\"" . $open_img_tag . "http://www.pbreview.com/fpics/$username$date$time$userfile_name$close_img_tag\"> </form></p>";
print "<font face=\"arial\" size=\"-1\"><b><p><a href=\"javascript:self.close()\"><font color=\"#FF9900\">Close This Window</font></a></p>";
print "<font face=\"arial\" size=\"-1\"><b><p><a href=\"http://www.pbreview.com/fpics/$username$date$time$userfile_name\" target=\"_blank\"><font color=\"#FF9900\">Click here to preview your image</font></font></a></p>";
}
// CHANGED HERE
} else {
printf("<font face=\"arial\" size=\"-1\"><b>Illegal file type. It has to be a jpg or gif. Please <a href=\"javascript:history.back()\"><font color=\"#FF9900\">click here</font></a> to go back and try again.");
Also make sure to take out the old statement that checks for file type!
Doesn't work. Now when I upload something, this comes up:
Code:
Warning: File Upload Error - Unable to open temporary file [./phpkJROIT] in /home/truthugs/forum/upload_file.php3 on line 299
Warning: Unable to open '' for reading: No such file or directory in /home/truthugs/forum/upload_file.php3 on line 54
Do me a huge favour, take both your files (upload.php and upload_file.php) and zip them up. Then upload them for a couple days or so or Email it to fred@truthugs.com.
I would be extremely greatful, because this stil isn't work..