PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Last edited by s.dot on Mon Sep 05, 2005 2:47 am, edited 1 time in total.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
As you can see, all four files pass nicely until it reaches the foreach(), and then it only grabs key 0 and 1 from the tmp_name array
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Okay, wow. I didn't touch the code even one character from earlier to now, and now the foreach is showing all of the values.
I don't understand how this could be. Perhaps someone on my host server was playing around with PHP? I don't know. I think I'll just stick with the for($i=0.... loop. For stability.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Okay, well on to the rest of the problem. I've stripped the loop down to the bare essentials it needs to loop through and upload the images. I can't seem to figure out why it won't work!
if($_POST['action'] == "uploadsubpictures")
{
$upload_dir = "uploads/$u/";
for($i=0;$i<9;$i++)
{
if($_FILES['filetoupload']['name'][$i])
{
$tmp_name = $_FILES['filetoupload']['tmp_name'][$i];
$filename2 = mysql_real_escape_string(strip_tags($_FILES['filetoupload']['name'][$i]));
$extension = strtolower(strchr($filename2,"."));
$extensions = array('.jpg','.jpeg','.png');
if(!in_array($extension,$extensions))
{
echo "<p class=\"main\"><font color=\"red\">File type not allowed. Only JPG or PNG files are allowed.</font></p>";
require 'footer.php';
die();
}
$str = rand(0,9999999);
$filename = $str.$extension;
include 'createthumb.inc.php';
createthumb("uploads/$u/$filename","thumbs/$u/$filename",100,100);
$size2 = filesize("uploads/$u/$filename");
mysql_query("INSERT INTO subpics (username, img, size) VALUES('$u','$filename','$size2')") or die(mysql_error());
}
}
}
This will take the first picture and do everything correctly with it. But after that it doesn't seem to do anything. Nothing is output when the script is done running (not even futher html after this code on the page) so I'm assuming the script "dies" somewhere. Does anyone see why?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
having include 'createthumb.inc.php'; inside of the loop was causing a problem.
I put it outside of the loop (dunno why I had it in there in the first place) and all is well.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.