Mihalism-Multi-Host v4.0.2 Problem !!!!

Discussion in 'PHP' started by PsyChoses, Aug 6, 2008.

  1. #1
    I'm using Mihalism-Multi-Host v4.0.2 but each time I try to upload an image I get this :

    Warning
    
    PHP Engine Error: Failed to write file Warez-BB3.png to disk.
    Code (markup):
    What can I do to fix this error ? I just installed that script last night ... Plz Help :(

    Site :
    http://image.stcgroup.org
    Code (markup):

     
    PsyChoses, Aug 6, 2008 IP
  2. aramex

    aramex Active Member

    Messages:
    243
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    gave 777 for image folder
     
    aramex, Aug 6, 2008 IP
  3. PsyChoses

    PsyChoses Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I did, not working :(
     
    PsyChoses, Aug 6, 2008 IP
  4. aramex

    aramex Active Member

    Messages:
    243
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    see disable function >>>remove copy() or fopen()
     
    aramex, Aug 6, 2008 IP
  5. PsyChoses

    PsyChoses Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    in what file ? Plus URL uploading worx fine :S

    Here's My upload.php :

    <?php
    	// ======================================== \
    	// Package: Mihalism Multi Host
    	// Version: 4.0.0
    	// Copyright (c) 2007, 2008 Mihalism, Inc.
    	// License: http://www.gnu.org/licenses/gpl.txt GNU Public License
    	// ======================================== /
    
    	require_once "./source/includes/data.php";
    	
    	$mmhclass->templ->page_title = "{$mmhclass->info->config['site_name']} &raquo; Upload";
    
    	if ($mmhclass->funcs->is_null($mmhclass->input->get_vars['url']) == true) {
    		for ($i = 0; $i <= 15; $i++) {
    			if ($mmhclass->input->file_vars['userfile']['error'][$i] != 4 && $mmhclass->funcs->is_null($mmhclass->input->file_vars['userfile']['name'][$i]) == false) {
    				$total_file_uploads++;
    
    				if ($total_file_uploads <= 15) {
    					$mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr />" : NULL);
    
    					$extension = $mmhclass->image->file_extension($mmhclass->input->file_vars['userfile']['name'][$i]);
    					$filename  = ($mmhclass->funcs->random_string(20).".{$extension}");
    					$thumbnail = $mmhclass->image->thumbnail_name($filename);
    					$filetitle = strip_tags((strlen($mmhclass->input->file_vars['userfile']['name'][$i]) > 20) ? (substr($mmhclass->input->file_vars['userfile']['name'][$i], 0, 20)."...") : $mmhclass->input->file_vars['userfile']['name'][$i]);
    
    					if (in_array($extension, $mmhclass->info->config['file_extensions']) == false) {
    						$mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> extension <b>.{$extension}</b> is not allowed.", false);
    					} elseif ($mmhclass->input->file_vars['userfile']['size'][$i] > $mmhclass->info->config['max_filesize']) {
    						$mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false);
    					} elseif ($mmhclass->image->is_image($mmhclass->input->file_vars['userfile']['tmp_name'][$i]) == false) {
    						$mmhclass->templ->html .= $mmhclass->templ->message("The file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> does not appear to be a real image.", false);
    					} elseif ($mmhclass->input->file_vars['userfile']['error'][$i] != 0) {
    						$file_errors = array(			
    							1 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <a href=\"http://us2.php.net/manual/en/ini.core.php#ini.upload-max-filesize\">upload_max_filesize</a> directive in php.ini.",
    							2 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> exceeds the <b><i>MAX_FILE_SIZE</i></b> directive that was specified in the HTML form.", // <- Never will be outputted as an error but still an option
    							3 => "<b>PHP Engine Error</b>: The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> was only partially uploaded.",
    							6 => "<b>PHP Engine Error</b>: Missing a temporary folder.",
    							7 => "<b>PHP Engine Error</b>: Failed to write image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> to disk.",
    							8 => "<b>PHP Engine Error</b>: Upload stopped by extension."
    						);
    						$mmhclass->templ->html .= $mmhclass->templ->error($file_errors[$mmhclass->input->file_vars['userfile']['error'][$i]], false);
    					} elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) {
    						$mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false);
    					} elseif (move_uploaded_file($mmhclass->input->file_vars['userfile']['tmp_name'][$i], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) {
    						$mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->input->file_vars['userfile']['name'][$i]}</b> failed to upload because of an unknown problem.", false);
    					} else {
    						chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644);
    
    						$mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); ");
    						$mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->input->file_vars['userfile']['size'][$i]}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->input->file_vars['userfile']['name'][$i])."'); ");
    						$mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');");
    
    						$mmhclass->image->create_thumbnail($filename);
    
    						$mmhclass->templ->html .= $mmhclass->templ->file_results($filename);
    					}
    				}
    			}
    		}
    	} else {
    		for ($i = 0; $i <= 15; $i++) {
    			if (strtolower(ini_get("allow_url_fopen")) == "on" || $mmhclass->funcs->is_null(ini_get("allow_url_fopen")) == true) {
    				$mmhclass->templ->error("<b>PHP Engine Error:</b> The <b>allow_url_fopen</b> directive must be enabled in php.ini in order to use URL upload.", true);
    			} else {
    				if ($mmhclass->funcs->is_null($mmhclass->input->post_vars['userfile'][$i]) == false) {
    					$total_file_uploads++;
    
    					if ($total_file_uploads <= 15) {
    						$mmhclass->templ->html .= (($total_file_uploads > 1) ? "<br /><hr>" : NULL);
    
    						$mmhclass->info->file_data = array(
    							"http" => $mmhclass->input->post_vars['userfile'][$i],
    							"name" => array_shift(explode("?", basename($mmhclass->input->post_vars['userfile'][$i]))),
    							"size" => strlen(implode("", file($mmhclass->input->post_vars['userfile'][$i]))),
    						);
    						
    						$extension = $mmhclass->image->file_extension($mmhclass->info->file_data['name']);
    						$filename  = ($mmhclass->funcs->random_string(20).".{$extension}");
    						$thumbnail = $mmhclass->image->thumbnail_name($filename);
    						$filetitle = strip_tags((strlen($mmhclass->info->file_data['name']) > 20) ? (substr($mmhclass->info->file_data['name'], 0, 20)."...") : $mmhclass->info->file_data['name']);
    
    						if (preg_match("/(https|http|ftp):\/\/[^\"\s']+/", $mmhclass->info->file_data['http']) == false || preg_match("/\.([a-zA-Z0-9])/", $mmhclass->info->file_data['name']) == false) {
    							$mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> contains an invalid URL.", false);
    						} elseif ($mmhclass->info->file_data['size'] == false) {
    							$mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> could not be opened.", false);
    						} elseif (in_array($extension, $mmhclass->info->config['file_extensions']) == false) {
    							$mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> extension <b>.{$extension}</b> is not allowed.", false);
    						} elseif ($mmhclass->info->file_data['size'] > $mmhclass->info->config['max_filesize']) {
    							$mmhclass->templ->html .= $mmhclass->templ->message("The image file <b>{$mmhclass->info->file_data['name']}</b> exceeds the maximum allowed filesize of <b>".$mmhclass->image->format_filesize($mmhclass->info->config['max_filesize'])."</b> per image.", false);
    						} elseif (is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == true || is_file($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$mmhclass->image->thumbnail_name($filename)) == true) {
    							$mmhclass->templ->html .= $mmhclass->templ->error("The filename <b>{$filename}</b> is already in existence on this server.", false);
    						} elseif (copy($mmhclass->info->file_data['http'], $mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename) == false) {
    							$mmhclass->templ->html .= $mmhclass->templ->error("The image file <b>{$mmhclass->info->file_data['name']}</b> failed to upload because of an unknown problem.", false);
    						} else {
    							chmod($mmhclass->info->root_path.$mmhclass->info->config['upload_path'].$filename, 0644);
    
    							$mmhclass->db->query("INSERT INTO `mmh_file_storage` (`filename`, `is_private`, `gallery_id`, `file_title`) VALUES ('{$filename}', '{$mmhclass->input->post_vars['private_upload']}', '{$mmhclass->info->user_data['user_id']}', '{$filetitle}'); ");
    							$mmhclass->db->query("INSERT INTO `mmh_file_logs` (`filename`, `filesize`, `ip_address`, `user_agent`, `time_uploaded`, `gallery_id`, `is_private`, `original_filename`) VALUES ('{$filename}', '{$mmhclass->info->file_data['size']}', '{$mmhclass->input->server_vars['remote_addr']}', '{$mmhclass->input->server_vars['http_user_agent']}', '".time()."', '{$mmhclass->info->user_data['user_id']}', '{$mmhclass->input->post_vars['private_upload']}', '".strip_tags($mmhclass->info->file_data['name'])."'); ");
    							$mmhclass->db->query("INSERT INTO `mmh_file_ratings` (`filename`, `total_rating`, `total_votes`, `voted_by`) VALUES ('{$filename}', '0', '0', '');");
    
    							$mmhclass->image->create_thumbnail($filename);
    
    							$mmhclass->templ->html .= $mmhclass->templ->file_results($filename);
    							
    							unset($mmhclass->info->file_data);
    						}
    					}
    				}
    			}
    		}
    	}
    	
    	if ($total_file_uploads < 1) {
    		$mmhclass->templ->error("Please go back and select at least one image file to upload.", true);
    	}
    
    	$mmhclass->templ->output();
    
    ?>
    Code (markup):
     
    PsyChoses, Aug 6, 2008 IP
  6. aramex

    aramex Active Member

    Messages:
    243
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #6
    u site is fine now
     
    aramex, Aug 6, 2008 IP
  7. PsyChoses

    PsyChoses Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    How come ? did you do anything ? coz I sure didn't :S

    EDIT :

    Error is back ... Plz someone help Me !!!! What can I do to fix this damn error ? Plz be precise as I'm a n00b :(
     
    PsyChoses, Aug 6, 2008 IP
  8. discuss4u

    discuss4u Well-Known Member

    Messages:
    845
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    108
    #8
    I also encounter the same problem. It was fine and suddenly I got the error...
     
    discuss4u, Sep 3, 2008 IP
  9. JohnnyB0

    JohnnyB0 Peon

    Messages:
    216
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yes! I have the same problem, I get:

    Warning:

    Image file xxx.jpg failed to upload because of an unknown problem.

    does anyone have a solution to this? It was working fine, but all of a sudden stopped...wtf? Please someone help! Thanks!
     
    JohnnyB0, Oct 7, 2008 IP
  10. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #10
    does your server have enough space
     
    Bohra, Oct 7, 2008 IP
  11. Sillysoft

    Sillysoft Active Member

    Messages:
    177
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #11
    You using a free hosting account? That error is familiar to me when I was using a free hosting account, happened when I went over limit.
     
    Sillysoft, Oct 7, 2008 IP
  12. JohnnyB0

    JohnnyB0 Peon

    Messages:
    216
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    No, I am using HostMonster. I have an unlimited account, so it should not run out of space. Should I contact them about the problem? I really cant figure this out. Also I know this isn't the place to post this, but if someone is willing to help me fix it, I would be willing to compensate them for their work.

    Thanks again for your time, and I hope someone can come up with the answer fast. Thanks!
     
    JohnnyB0, Oct 8, 2008 IP
  13. mehrdad_menay

    mehrdad_menay Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    i have this problem with plesk

    The image file 43.gif failed to upload because of an unknown problem.
     
    mehrdad_menay, Feb 26, 2009 IP
  14. strat

    strat Active Member

    Messages:
    154
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #14
    I just had this problem today chmod 777 the image folder
     
    strat, Mar 31, 2009 IP