codexx Posted August 4, 2007 Share Posted August 4, 2007 Hey Everyone, I have this following script that uploads then ftp's the file to another server. I'm having a problem where it won't let me upload files over 1.5 MB. <?php if($_FILES['image']['type'] == 'image/pjpeg' || $_FILES['image']['type'] == 'image/gif'){ $size = 90; // the thumbnail width $maxfile = '200000'; //maximum file size to upload $mode = '0666'; $userfile_name = $_FILES['image']['name']; $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $userfile_type = $_FILES['image']['type']; if (isset($_FILES['image']['name'])) { $prod_img = "tmp/".$_SESSION['onlineuser']."-original".$_FILES['image']['name']; $prod_img_thumb = "tmp/".$_SESSION['onlineuser']."-".$_FILES['image']['name']; move_uploaded_file($userfile_tmp, $prod_img); chmod ($prod_img, octdec($mode)); $sizes = getimagesize($prod_img); $aspect_ratio = $sizes[1]/$sizes[0]; if ($sizes[0] <= $size) { $new_width = $sizes[0]; $new_height = $sizes[1]; }else{ $new_height = $size; $new_width = abs($new_height/$aspect_ratio); } $destimg=imagecreatetruecolor($new_width,$new_height) or die('Problem In Creating image'); $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image'); ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, $new_width, $new_height, $sizes[0], $sizes[1]) or die('Problem In resampling'); ImageJPEG($destimg,$prod_img_thumb,50) or die('Problem In saving'); imagedestroy($destimg); } //Update User Account //FTP It to image servers $ftp_server = "mysite.com"; // FTP Server Address (exlucde ftp://) $ftp_user_name = "image@mysite.com"; // FTP Server Username $ftp_user_pass = "password"; // Password $conn_id = ftp_connect($ftp_server); // Login to FTP Server $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // Verify Log In Status if ((!$conn_id) || (!$login_result)) { echo "Upload connection has failed! <br />"; exit; } else { } $time = time(); $local_file = "tmp/".$_SESSION['onlineuser']."-".$_FILES['image']['name']; $destination_file = "/thumb/".$_SESSION['onlineuser']."-".$time.".jpg"; // Path for File Upload (relative to your login dir) $upload = ftp_put($conn_id, $destination_file, $local_file, FTP_BINARY); // Upload the File $local_file = "tmp/".$_SESSION['onlineuser']."-original".$_FILES['image']['name']; $destination_file = "/".$_SESSION['onlineuser']."-large".$time.".jpg"; // Path for File Upload (relative to your login dir) $upload = ftp_put($conn_id, $destination_file, $local_file, FTP_BINARY); // Upload the File // Verify Upload Status ftp_close($conn_id); // Close the FTP Connection dbConnect(); $url = "http://mysite.com/".$_SESSION['onlineuser']."-large".$time.".jpg"; $update = mysql_query ("UPDATE members SET prolargeimg_1 = '".$url."', proimg_1 = mysite.com/thumb/".$_SESSION['onlineuser']."-".$time.".jpg' WHERE username = '".$_SESSION['onlineuser']."'"); ?> <h2> Complete </h2> <? }else{ ?> This is an invalid file type, you must upload a jpeg photo! <? } ?> Quote Link to comment https://forums.phpfreaks.com/topic/63272-image-upload-problems/ Share on other sites More sharing options...
plutomed Posted August 4, 2007 Share Posted August 4, 2007 What is the max size you want? And are you on hosting or do you host it yourself? If you don't host your self your host might have set the max file upload size via php to 1.5mb Quote Link to comment https://forums.phpfreaks.com/topic/63272-image-upload-problems/#findComment-315445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.