Jump to content

krash11554

Members
  • Posts

    59
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

krash11554's Achievements

Member

Member (2/5)

0

Reputation

  1. I have errror 4 which is no file is selected but how come it passes the isset()? if there is no file selected??
  2. I have code that checks if a file is selected do this. But my problem is it is running that code even though i dont have a selected file in a input box. heres the code. if(isset($_FILES['editcar_fileupload']) && empty($_POST) === false){ //check where to start uploading pictures $image_name = $_FILES['editcar_fileupload']['name']; $image_size = $_FILES['editcar_fileupload']['size']; $image_temp = $_FILES['editcar_fileupload']['tmp_name']; $allowed_ext = array('jpg','jpeg','png','gif'); $count = count($image_name); if (isset($image_name) && empty($image_name) === false){ foreach($image_name as $image_names){ $image_ext = strtolower(end(explode('.', $image_names))); if(in_array($image_ext, $allowed_ext) === false && $true === true){ $errors[] = 'File type is not allowed'; } } if($count > 10){ $errors[] = 'You can not upload more than 10 pictures for your car.'; } } } here is the html <input type="file" onchange="this.form.editcar_fakeinput.value = this.value;" name="editcar_fileupload[]" multiple="multiple" id="editcar_fileupload" /> it says the $image_name has values in it but it really dosent.
  3. When i use var_dump(), i get array(0){}.
  4. Yea that's now how it is in the real code I must of did thy when pasting the code. I guess that's not the problem
  5. i have this glob function. here it is $howmanycarpics = glob(" /garage/uploads/cars/15/thumbs/car1"/*.*"); print_r($howmanycarpics); i think this should return all files in that folder but it isnt
  6. Even In gonna use the session for a short time ?
  7. So i have i a post varialbe containg and a id and when you click the submit button it would take you to a different page. I picked up the variable from the first form but how would i keep the information in another variable after i refresh the second page. What i have now is i get the information from the form then when i refresh the page i loose it.
  8. So all iahve to do is put the directory in the function?
  9. I have had this same problem when i started to make to directorys with mdir function. now i am having problems when i use the unlink function. heres the code. unlink('uploads/cars/' . $user_id . '/car' . $car_number . '/'); unlink('uploads/cars/' . $user_id . '/thumbs/car' . $car_number . '/'); I am getting back Warning: rmdir(uploads/cars/15/car1/) [function.rmdir]: Directory not empty inC:\inetpub\wwwroot\garage\phpfunctions\functions.php on line 315 Warning: unlink(uploads/cars/15/thumbs/car1/) [function.unlink]: Permission denied inC:\inetpub\wwwroot\garage\phpfunctions\functions.php on line 317 I have already set all permissions to the root directory idk what else to do. By the way im on IIS. Thanks
  10. So i have a function that i made and cant seem to figure out why its not working. the function should make the image smaller then 650 by 550. function makelargeimage($directory,$image,$destination){ $image_file = $image; $image = $directory.$image; if (file_exists($image)) { $source_size = getimagesize($image); $width = $source_size['width']; $height = $source_size['height']; $max_height = 650; $max_width = 550; switch($source_size['mime']) { case 'image/jpeg': $source = imagecreatefromjpeg($image); break; case 'image/png': $source = imagecreatefrompng($image); break; case 'image/gif': $source = imagecreatefromgif($image); break; } if($width < $max_width && $height < $max_height){ //good }elseif($width > $height){ //longer if($width > $max_width || $height > $max_height){ //longer but bigger then 650x550 for($i = 1; $width >= 650; $i+=.1){ $new_width = $width / $i; $new_height = $height / $i; } } }elseif($width < $height){ //taller if($width > $max_width || $height > $max_height){ //taller but bigger then 650x550 for($i = 1; $width >= 650; $i+=.1){ $new_width = $width / $i; $new_height = $height / $i; } } }elseif($width == $height){ //square if($width > $max_width || $height > $max_height){ //square but bigger then 650x550 for($i = 1; $width >= 650; $i+=.1){ $new_width = $width / $i; $new_height = $height / $i; } } } $large_image = imagecreatetruecolor($new_width, $new_height); switch($source_size['mime']) { case 'image/jpeg': imagejpeg($large_image, $destination.$image_file); break; case 'image/png': imagepng($large_image, $destination.$image_file); break; case 'image/gif': imagegif($large_image, $destination.$image_file); break; } } } heres when i call the function makelargeimage('uploads/cars/15/car1/thumbs/' , kyle.jpg, 'uploads/cars/15/thumbs/car/1/); idk where its going wrong. any help is appreciated
  11. This foreach loop in my function isnt working. It only moves the pictures when $image_temp is one picture, but when $image_temp is an array, i thought it should loop around again and move the other images. i cant seem to figure out why it isnt looping around again. heres the function. function addcar_uploaddata($num_rows,$image_ext,$image_temp,$user_id,$car_data){ $user_id = (int)$user_id; array_walk($car_data, 'array_sanitize'); $fields = '`' . implode('`, `', array_keys($car_data)) . '`'; $data = '\'' . implode('\', \'', $car_data) . '\''; mysql_query("INSERT INTO cars ($fields) VALUES ($data)"); $num_rows = $num_rows + 1; $car_id = mysql_insert_id(); $car_file = $car_id . '.' . $image_ext; mkdir('uploads/cars/' . $_SESSION['user_id'] . '/car' . $num_rows,0744); mkdir('uploads/cars/' . $_SESSION['user_id'] . '/thumbs',0744); foreach($image_temp as $image_temps){ move_uploaded_file($image_temps, 'uploads/cars/' . $_SESSION['user_id'] . '/car' . $num_rows . '/' . $car_file); create_thumb('uploads/cars/' . $_SESSION['user_id'] . '/' . 'car' . $num_rows , $car_file, 'uploads/cars/' . $_SESSION['user_id'] . 'thumbs/',150,150); } } allot of the function you dont need to see but i put it in anyway
  12. I know about mkdir function but that only makes a directory, i think. Is there a way to add a folder to a directory? Thanks
  13. This is why im confused bc idk anything you just said hahah. if you can explain it a little more it would probably help. thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.