Jump to content

dennismonsewicz

Members
  • Posts

    1,136
  • Joined

  • Last visited

Everything posted by dennismonsewicz

  1. Thanks for the suggestions. I fixed my problem. Gotta love optimization
  2. I am actually about to go reset that... I shall let you know what happens
  3. I am trying to upload an image that is 4.5MB and my script is set to upload up to 3GB (JUST FOR TESTING) and for some reason the file doesn't upload. A link to the file appears but the actual upload does not happen. here is my code <?php include "includes/header.php"; include "includes/sidebar.php"; ?> <div class="maincontent"> <?php $_SESSION['username'] = $_GET['username']; if($_POST['categories']) { // ============== // Configuration // ============== $uploaddir = "imageuploads"; // Where you want the files to upload to - Important: Make sure this folders permissions is 0777! $allowed_ext = "pjpg, jpg"; // These are the allowed extensions of the files that are uploaded $max_size = "3221225472"; // 50000 is the same as 50kb $max_height = ""; // This is in pixels - Leave this field empty if you don't want to upload images $max_width = ""; // This is in pixels - Leave this field empty if you don't want to upload images $uploaded_by = $_SESSION['username']; $name = $_FILES['file']['name']; $filesize = $_FILES['file']['size']; $filetype = $_FILES['file']['type']; $url = "http://intranet.healthresources.net/hrstock/" . $uploaddir; $categories = $_POST['categories']; // Check Entension $extension = pathinfo($_FILES['file']['name']); $extension = $extension[extension]; $allowed_paths = explode(", ", $allowed_ext); for($i = 0; $i < count($allowed_paths); $i++) { if ($allowed_paths[$i] == "$extension") { $ok = "1"; } } // Check File Size if ($ok == "1") { if($_FILES['file']['size'] > $max_size) { print "File size is too big!"; exit; } // Check Height & Width if ($max_width && $max_height) { list($width, $height, $type, $w) = getimagesize($_FILES['file']['tmp_name']); if($width > $max_width || $height > $max_height) { print "File height and/or width are too big!"; exit; } } // The Upload Part if(is_uploaded_file($_FILES['file']['tmp_name'])) { move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'.$_FILES['file']['name']); } echo "<div class='maincontentheader'> <h2>" . ucwords($_SESSION['username']) . ", thank you for your upload!</h2> </div>"; echo "<p>Your file has been uploaded successfully! Yay!</p>"; echo "<p> </p>"; echo "<p><a href='upload.php?username=" . $_SESSION['username'] . "'>Upload another?</a></p>"; include "includes/sql.php"; $query = "insert into uploads (username, name, size, type, url, categories, number_of_downloads) " . "values ('$uploaded_by', '$name', '$filesize', '$filetype', '$url', '$categories', '0')"; mysql_query($query) or die("ERROR: " . mysql_error()); //on-th-fly thumbnail generator include "thumbtest.php"; } else { print "Incorrect file extension!"; } } else { echo '<div class="maincontentheader"> <h2>' . ucwords($_SESSION['username']) . ', use the form below to upload an image!</h2> </div> <p>Make sure to add categories to this image.</p> <p> </p> <p>Adding categories allows for the image to show up during an image search!</p> <p> </p> <p>Example Categories: Cat, Dog, Ocean, Older Male, Female, etc...</p> <p> </p> <p style="font-size: 80%"><b>Note: if you have more than one category please make sure to separate them by a comma!</b></p> <p> </p> <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="upload.php?username=' . $_SESSION['username'] . '" method="POST" name="uploadfile"> <!-- Name of input element determines name in $_FILES array --> <p>Image Categories: <input name="categories" type="text" /></p> <p> </p> <p>Upload this file: <input name="file" type="file" /></p> <p><input type="submit" value="Upload File" /></p> </form>'; } ?> <div class="maincontentfooter"> </div> </div> <?php include "includes/footer.php"; ?>
  4. How do you pass variables from a flash file to a PHP page?
  5. I went to it in the URL, and it works, but it isn't working when i call it in the src <img src="imageuploads/imageresize.php?maxsize=500&source=<? echo $imagename; ?>" border="0" />
  6. ok disregard what I just asked... I tried your script and got nothing: <?php $imagename = $result['name']; $imagesize = $result['size']; $kbsize = number_format($imagesize / 1024); $url = $result['url']; $uploadedby = $result['username']; $cats = $result['categories']; $numberofdownloads = $result['number_of_downloads']; ?> <div class="maincontent"> <div class="maincontentheader"> <h2><?php echo ucwords($username); ?> here is <?php echo $imagename; ?>'s information!</h2> </div> <table width="690" cellpadding="4" cellspacing="0" border="0" align="center"> <tr> <td bgcolor="#dcdcdc" width="325" align="center" style="border: 1px solid #666666;"><img src="imageresize.php?maxsize=150&source=<? echo $imagename; ?>" border="0" /></td> <td valign="top"><p><b>Image Name:</b> <?php echo $imagename; ?></p> <p><b>Image Size:</b> <?php echo $kbsize; ?> KB</p> <p><b>Uploaded By:</b> <?php echo ucwords($uploadedby) ?></p> <p><b>Categories:</b> <?php echo $cats ?></p> <p><b>Number of Downloads:</b> <?php echo $numberofdownloads ?></p> </td> </tr> </table> <div class="maincontentfooter"> </div> </div> <?php include "includes/footer.php"; ?>
  7. ok sweet, next question: how does this file know where to grab the sourcefile from?
  8. I am trying to create a thumbnail of an image on the fly, but its not working. Here is my code: // load image and get image size $img = imagecreatefromjpeg( "{$url}" ); $width = imagesx( $img ); $height = imagesy( $img ); // calculate thumbnail size $new_width = $thumbWidth; $new_height = floor( $height * ( $thumbWidth / $width ) ); header("Content-Type: image/jpeg"); // create a new temporary image $tmp_img = imagejpeg( $new_width, $new_height ); This is my code to display the image: <img src="<?php echo $tmp_img; ?>" border="0" /> Any help?
  9. Well first I wouldn't use $_REQUEST cause it contains post, get, and cookie data.
  10. I have the following code to calculate how many times a person has downloaded an image and then multiply the number of downloads by $300, but it doesn't work. $downloadcount = "select COUNT(username) from $tbl_name where username = '" . $_SESSION['username'] . "'"; $downloadresult = mysql_query($downloadcount)or die(mysql_error()); $downloadrow = mysql_fetch_array($downloadresult); $download_count = $downloadrow['COUNT(username)']; $multiplied = $download_count * 300; setlocale(LC_MONETARY, 'en_US'); $moneysaved = money_format('%i', $multiplied); if(isset($_SESSION['username'])) { $fyi = '<p> </p> <p><b>FYI: YOU HAVE SAVED \$' . $moneysaved . '!</b></p>'; } else { $fyi = ''; } I can echo out the $multiplied var and it works fine but for some reason when i try to run the money_format() it messes up. Any ideas?
  11. Does anyone know how to do a multiple image upload and have a PHP file parse the data to place requested data from the images into a mysql database?
  12. Does anyone know where I could learn how to send messages through a site? Like how I can send a message to a particular user within this site.
  13. Ok, Let me try to explain this a little better. I am wanting to track which image a user downloads. I have a downloaded_by field in my DB. Is there anyway to update this field with the username and have it just add the username on everytime that image is downloaded? For example: downloaded_by: dennis, john, susie... Instead of overwriting this field everytime
  14. I also have a field in my Database that is supposed to track who downloads what image, but how do I update the field so it just adds the username to the field without overwriting the previous entry?
  15. in the database, would it be an int or a varchar?
  16. I have a stock photo site and I am looking for a way to track the number of downloads per image. Whats the best way to implement a system that will show the most popular downloaded images?
  17. Fixed it guys! Forgot to Restart the server... Its been a REALLY long day! And Trilby we do not live in a walgreens perfect world, so errors are going to happen
  18. I turned it on, on my server but i am still getting a blank white page. Any ideas?
  19. And this is where I shall keep my comments to myself
  20. How do you turn on Error Reporting?
  21. aight thanks buddy, I am trying to work around an ASP problem. And my boss doesn't want to switch to PHP, so I am trying to convince my boss to switch, but so far no luck
×
×
  • 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.