Immortal55 Posted March 27, 2006 Share Posted March 27, 2006 I am working on a gallery, I got it from a tutorial, and i am tweaking it but after i select my photos and press the submit button it just sits there loading and nothing happens and then i get this error message:Fatal error: Maximum execution time of 30 seconds exceeded in /home/.diddle/studiocommunity/studiocommunity.net/artupload.php on line 65here are the scriptsartuploadforms.php:[code]<?include 'image.dbconnect.php'; // initialization $photo_upload_fields = ''; $counter = 1; // If we want more fields, then use, preupload.php?number_of_fields=20 $number_of_fields = (isset($_GET['number_of_fields'])) ? (int)($_GET['number_of_fields']) : 5; // Firstly Lets build the Category List $result = mysql_query('SELECT category_id,category_name FROM art_category'); while($row = mysql_fetch_array($result)) { $photo_category_list .= <<<__HTML_END<option value="$row">$row</option>\n__HTML_END; } mysql_free_result($result); // Lets build the Image Uploading fields while($counter <= $number_of_fields) { $photo_upload_fields .= <<<__HTML_END<tr><td> Photo {$counter}: <input name="photo_filename"type="file" /></td></tr><tr><td> Caption: <textarea name="photo_caption" cols="30" rows="1"></textarea></td></tr>__HTML_END; $counter++; } // Final Output echo <<<__HTML_END<html><head><title>Lets upload Photos</title></head><body><form enctype="multipart/form-data" action="artupload.php" method="post" name="upload_form"> <table width="90%" border="0" align="center" style="width: 90%;"> <tr><td> Select Category <select name="category"> $photo_category_list </select> </td></tr> <!—Insert the image fields here --> $photo_upload_fields <tr><td> <input type="submit" name="submit" value="Add Photos" /> </td></tr> </table></form></body></html>__HTML_END;?>[/code]and artupload.php[code]<? include ('image.dbconnect.php');// Fetch the image array sent by preupload.php$photos_uploaded = $_FILES['photo_filename'];// Fetch the image caption array$photo_captions = $_POST['photo_captions'];$photo_types = array( 'image/pjpeg' => 'jpg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png');while($counter <= count($photos_uploaded)) { if($photos_uploaded['size'][$counter] > 0) { if(!array_key_exists($photos_uploaded['type'][$counter], $photo_types)) { $result_final .= 'File ' . ($counter + 1) . ' is not a photo<br />'; } else { // Great the file is an image, we will add this file } }}mysql_query(" INSERT INTO art_photos (photo_filename, photo_caption, photo_category) VALUES ('0', '" . $photo_captions[$counter]) . "', '" . $_POST['category'] . "')'";$new_id = mysql_insert_id(); // New Id generated// Get the filetype of the uploaded file$filetype = $photos_uploaded['type'][$counter]; // Get the extension for the new name$extension = $known_photo_types[$filetype]; // Generate a new name$filename = "$new_id.$extension"; // let’s update the filename nowmysql_query(" UPDATE gallery_photos SET photo_filename = '$filename' WHERE photo_id = '$new_id'");copy($photos_uploaded['tmp_name'][$counter], $images_dir . '/' . $filename); move_uploaded_file($photos_uploaded['tmp_name'][$counter], $images_dir . '/' . $filename);?>[/code]what is wrong?? thank you. Quote Link to comment https://forums.phpfreaks.com/topic/5965-gallery-script-help/ Share on other sites More sharing options...
Immortal55 Posted March 28, 2006 Author Share Posted March 28, 2006 anyone? help, please. Quote Link to comment https://forums.phpfreaks.com/topic/5965-gallery-script-help/#findComment-21405 Share on other sites More sharing options...
ToonMariner Posted March 28, 2006 Share Posted March 28, 2006 OK.In the artupload file you have this....[code]<?php.......$counter = 0; //ADD THIS LINE.while($counter <= count($photos_uploaded)) {if($photos_uploaded['size'][$counter] > 0) { if(!array_key_exists($photos_uploaded['type'][$counter], $photo_types)) { $result_final .= 'File ' . ($counter + 1) . ' is not a photo<br />'; } else { // Great the file is an image, we will add this file }}$counter++; //ADD THIS LINE}...?>[/code]you still need anotehr loop to copy all teh files (it looks to me that you will only actually do one upload completely with script) but that is for you to throw and catch Quote Link to comment https://forums.phpfreaks.com/topic/5965-gallery-script-help/#findComment-21411 Share on other sites More sharing options...
Immortal55 Posted March 28, 2006 Author Share Posted March 28, 2006 alright, i added all that but now i am getting this warning:[b]Warning: copy(h): failed to open stream: No such file or directory in /home/.diddle/studiocommunity/studiocommunity.net/artupload.php on line 102[/b] Quote Link to comment https://forums.phpfreaks.com/topic/5965-gallery-script-help/#findComment-21423 Share on other sites More sharing options...
Immortal55 Posted March 28, 2006 Author Share Posted March 28, 2006 i still cannot get it, does anybody have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/5965-gallery-script-help/#findComment-21477 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.