Jump to content

need help with this script for multiple image uploads to DB


svgmx5

Recommended Posts

What i have is a form where users can upload various images into the server. The problem is that the images are not being uploaded into the server folder. They are added to the database, but not to the server

 

Here's the code that i have

<?php
if(isset($_POST['submit'])){
	$target = 'images/test/';

	for ($l = 0; $l <= 1000; $l++){
		$dir = $target.$_FILES['file_'.$i]['name'];
		move_uploaded_file($_FILES['file_'.$i]['tmp_name'], $dir);
	}

	$query = "INSERT INTO project_images (imageURL) VALUES ";
	$inserts = array();
	for ($i = 0; $i <= 1000; $i++){
		if (isset($_FILES['file_'.$i]['name'])){
			$inserts[] = "('".$_FILES['file_'.$i]['name']."')";
		}
	}

	if (count($inserts) > 0){
		$query .= implode(', ', $inserts);
		$result = mysql_query($query) or die(mysql_error());
	}
}

?>

 

I don't get any errors at all

 

Hope someone can help

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.