Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 12-21-2000 Last Update: Never Installs: 0
 
No support by the author.

The image upload hack found here:
http://www.vbulletin.com/forum/showt...?threadid=5669
is not working for me. I've tried posting in that thread but no one is answering. Can anyone help?

I keep on getting the "This is an illegal file type" error even though the images are jpg or gif.

In the upload_file.php script, I have my path as: forums/images/public/ and changed the "public" folder to 777 CHMOD as specified.

For maximum file size, I have 20000.

What am I doing wrong? I am running vB 1.1.4 and PHP4.

Thanks
-Hideki

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 12-21-2000, 03:02 PM
Guest
 
Posts: n/a
Default

Hey, I've got the exact problem as you.

I've got all my forums modified to that hack, and it don't work.. grr... And the creator of it, JimF, doesnt seem to talk about it anymore.

I think it might have something to do with the variables I edited in upload_file.php3 (well php in your case). I set the image size to 150000 (I'm thinking this script was counting in bytes, so 150000 = 150kb).

I'm in desperate help now, cause this is taking too long to setup when it could be done in a second by fixing those variables I think.

[Edited by Fred on 12-21-2000 at 12:05 PM]
Reply With Quote
  #3  
Old 12-21-2000, 07:47 PM
Guest
 
Posts: n/a
Default

20000 = 20Kb. That's an awfully small file. It is strange that it is giving you the wrong error. I'm busy as hell this week and next week, but I'll try to find time to work on a fix for this. I don't want to spend too much time doing this, because I could be spending that time working on v2.0, which will include this feature anyway, I believe. But I'll see what I can do.

It works fine for me, that's all I can really say. The code in the Zip file is exactly the same as I have on my board where it works fine.

-jim
Reply With Quote
  #4  
Old 12-21-2000, 07:53 PM
Guest
 
Posts: n/a
Default

For a temporary fix, remove this part of the code:

Code:
// Check file type
if (!eregi("\.jpg$", "\.gif$", $userfile_name)) {
    print "Illegal file type. Only files with .jpg and .gif extensions can be uploaded.<br>Please <a href=\"javascript:history.back()\">click here</a> to go back and try again.";
    exit;

}
I'll see why this code wasn't working as soon as I get a chance. Regardless, the code that the user is given is an img code, so it won't display if it's not an image.

-jim
Reply With Quote
  #5  
Old 12-21-2000, 07:54 PM
Guest
 
Posts: n/a
Default

Thanks Jim, I really would like to incorporate your hack.
-Hideki
Reply With Quote
  #6  
Old 12-21-2000, 11:31 PM
Guest
 
Posts: n/a
Default

JimF,

something is really weird. I did what you said, I removed that part of the coding like the stated above. But now when I uplod an image, it gives me this:

Code:
// This is the script that takes the form values and uploads the image to the server.
Reply With Quote
  #7  
Old 12-22-2000, 12:29 AM
Guest
 
Posts: n/a
Default

Use this line here:
if ($userfile_type == "image/gif" or $userfile_type == "image/pjpeg" or $userfile_type == "image/jpeg") {

So in code it would look like this:



if ($userfile_type == "image/gif" or $userfile_type == "image/pjpeg" or $userfile_type == "image/jpeg") {

// 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 :-)

$open_img_tag = "";




// 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 ) 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>";


}
} 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.");

}
Reply With Quote
  #8  
Old 12-22-2000, 02:21 AM
Guest
 
Posts: n/a
Default

6impy, a couple of questions.

1. Where does your code go and if it does, what does it replace?

2. I'm getting broken images "red x" in your code in a couple of places.

I really do appreciate your willingness to help though.
Thanks.
Reply With Quote
  #9  
Old 12-22-2000, 11:31 PM
Guest
 
Posts: n/a
Default

Oh here is the file I use (the changes are noted with // CHANGED HERE):

--------------------------------------------------------------------

<?

require("global.php");

// 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 :-)

$open_img_tag = "";




// 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 ) 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.");

}
//END CHANGED HERE
?>


------------------------------------------------------------

Also make sure to take out the old statement that checks for file type!
Reply With Quote
  #10  
Old 12-22-2000, 11:43 PM
Guest
 
Posts: n/a
Default

Quote:
Originally posted by Fred
JimF,

something is really weird. I did what you said, I removed that part of the coding like the stated above. But now when I uplod an image, it gives me this:

Code:
// This is the script that takes the form values and uploads the image to the server.
At the very top of file_upload.php there is "// This is the script that takes the form values and uploads the image to the server. "

Remove that!

It is not commenting it because it is not between <? and ?>
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:16 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03945 seconds
  • Memory Usage 2,277KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete