PHP - Moved: Php Upload Scripts? Which Is The Best? Any Suggestions?
This topic has been moved to Miscellaneous.
http://www.phpfreaks.com/forums/index.php?topic=330946.0 Similar TutorialsHi All, What I'm trying to do: I have a page where users can upload pictures of their property / house. They can upload a picture, add a specific name such as (Front of house), add a description of each picture and choose an order of appearance. Once the pictures are uploaded, I would like them to display on screen, in a smaller resolution. Once you click on the picture it will become the original size again. In displaying the pictures, I would need a fancy way of allowing the user to choose the order, specifically allowing them to choose the "display" picture, much like realtor sites. Can anyone give me some suggestions / tutorials as to what I am looking for? I'm assuming this would be a mixture of PHP and JQuery? Thanks for reading. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=308872.0 This topic has been moved to Website Critique. http://www.phpfreaks.com/forums/index.php?topic=346717.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=310577.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317963.0 I had to move hosters recently and I have a couple of scripts run using CRON to backup my MySql database and manage the number of backups that I keep. I can ask the hosters to deprecate the version of PHO backwards but I don't want to lose the opportunity of features that may be available in the new version. The main script essentially performs a MySqlDump to a specified directory and then emails me to tell me that it completed successfully. The second script just deletes any files in the backup folder more than x days old. I know mysqldump is a valid call so I should need to use anything other than that but I'm lost when it comes to seeing what is wrong with my scripts. backup.php
<?
/* CONFIGURE THE FOLLOWING SEVEN VARIABLES TO MATCH YOUR SETUP */
//$dbuser = $db_user, $conection ; // Database username
$command = "mysqldump -u $db_user --password=$db_password $db_name | gzip > $filename"; copy ($filename, $backdir.$newfile);
unlink($filename); //delete the backup file from the server
and delold.php
<?php
//echo "script is running";
if (is_dir("$path") )
}
This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=321119.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=310954.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357648.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314887.0 This topic has been moved to Editor Help (Dreamweaver, Zend, etc). http://www.phpfreaks.com/forums/index.php?topic=343605.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=349362.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=334078.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=346271.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=357764.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=341970.0 This topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=307015.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=328623.0 Hi everyone, I have a page that i use to upload images to my website, i got a bit fed up of uploading one at a time so i decided to add multiple file fields to the form to upload multiple images at the same time. Im having a few problems, iv read up he http://www.php.net/manual/en/features.file-upload.multiple.php and it seems all i have to do is add [] to the form names to turn them into arrays. However when i come to upload the images, i keep getting the "$error[] = "Incorrect format!...." error from the code below. I cant seem to figure out what the problem is. Could anybody please point me in the right direction? <?php session_start(); $id = $_SESSION['id']; $connect = mysql_connect("localhost","leemp5_admin","p7031521"); mysql_select_db("leemp5_database"); $query = mysql_query("SELECT * FROM users WHERE id='$id'"); $row = mysql_fetch_assoc($query); $username = $row['username']; $submit = $_POST['submit']; $type = $_FILES['image']['type']; $size = $_FILES['image']['size']; $max_size = "1000"; $width = "100"; $height = "100"; $error = array(); function make_thumb($image_name,$filename,$new_width,$new_height) { $ext=getExtension($image_name); if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) $source_image=imagecreatefromjpeg($image_name); if(!strcmp("png",$ext)) $source_image=imagecreatefrompng($image_name); if(!strcmp("gif",$ext)) $source_image=imagecreatefromgif($image_name); $old_x=imageSX($source_image); $old_y=imageSY($source_image); $ratio1=$old_x/$new_width; $ratio2=$old_y/$new_height; if($ratio1>$ratio2) { $thumb_width=$new_width; $thumb_height=$old_y/$ratio1; } else { $thumb_height=$new_height; $thumb_width=$old_x/$ratio2; } $destination_image=ImageCreateTrueColor($thumb_width,$thumb_height); imagecopyresampled($destination_image,$source_image,0,0,0,0,$thumb_width,$thumb_height,$old_x,$old_y); if(!strcmp("jpg",$ext) || !strcmp("jpeg",$ext)) { imagejpeg($destination_image,$filename); } if(!strcmp("png",$ext)) { imagepng($destination_image,$filename); } if(!strcmp("gif",$ext)) { imagegif($destination_image,$filename); } imagedestroy($destination_image); imagedestroy($source_image); } function getExtension($str) { $i = strrpos($str,"."); if (!$i) { return ""; } $l = strlen($str) - $i; $ext = substr($str,$i+1,$l); return $ext; } if($submit) { $image=$_FILES['image']['name']; if ($image) { $filename = stripslashes($_FILES['image']['name']); $extension = getExtension($filename); $extension = strtolower($extension); if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { $error[] = "Incorrect format! Please make sure your image is a .jpg, .jpeg, .png or .gif file."; } else { $size=getimagesize($_FILES['image']['tmp_name']); $sizekb=filesize($_FILES['image']['tmp_name']); if ($sizekb > $max_size*1024) { $error[] = "Your image is too big! The maximum upload size is 1MB."; } else { $image_name=time().'.'.$extension; $newname="uploads/" . $username . "/images/".$image_name; $copied = copy($_FILES['image']['tmp_name'], $newname); if (!$copied) { $error[] = "There was an error uploading your image. Please try again!"; } else { $thumb_name='uploads/' . $username . '/images/thumbs/thumb_'.$image_name; $thumb=make_thumb($newname,$thumb_name,$width,$height); } } } } else { $error[] = "Please select an image to upload!"; } if(empty($error)) { echo "Upload Successfully!<br />"; echo '<img src="'.$thumb_name.'">'; mysql_query("INSERT INTO images VALUES ('','$username','$image_name','','','','','uploads/$username/images/$image_name','uploads/$username/images/thumbs/thumb_$image_name','$type','$size')"); } else { echo implode($error); } } ?> <form method="post" enctype="multipart/form-data" action="upload_images.php"> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="file" name="image[]" /><br /> <input type="submit" name="submit" value="Upload"> </form> Thanks I have code written for image uploading, but it doesn't allow multiple images on a single upload, and doesn't re-size. Anyone willing to share a good upload script that will do the following?: -Allow multiple image uploads (10+ per submission), -Re-size images on upload, and -Rename images. Thanks Brett |