Hi,
And thank you for any help.
My script take a name from the DB (“ID” +1) and with this number create a folder after that he will upload and send the pictures selected by the user to this folder after that he will record the path to this picture on MYSQL.
Now the script can upload the pictures and record the path but he can’t do both at the same time. I isolate the problem and if we use this name=”file[0]” on the script we can upload the picture with out problems and if we use name=”file0″ we can record the path. I hope someone can help me to modify the script on a way that he can upload/record the path at the same time.
[color=Blue] Here is the 4 places where we need make the changes name=”file0″ / name=”file[0]” and at the end of this post you can download all the script by clicking the link
[b]lines 152
[code=php]
<!– change/cambiar this name=”file[0]” by name=”file0″ –>
<input class=”file” type=”file” name=”file0″ />
[b]line 245
[code=php]
<!– change/cambiar this name=”file[0]” by name=”file0″ –>
<input class=”file” type=”file” name=”file0″ />
[b]line 273
[code=php]
<!– change/cambiar this name=”file[0]” by name=”file0″ –>
<input class=”file” type=”file” name=”file0″ />
[b]line 282
[code=php]
<!– change/cambiar this name=”file[0]” by name=”file0″ –>
<input class=”file” type=”file” name=”file0″ />
[color=Blue] [size=5] “The CODE”
by clicking here you can download the code: [url=http://www.megaupload.com/?d=01MICDFH]http://www.megaupload.com/?d=01MICDFH
The uploading function
[code=php] <?
}
function upload_file ($upload_path, $fname, $fileid)
{
$problem = TRUE;
switch ($_FILES[‘file’][‘error’][$fileid])
{
case UPLOAD_ERR_FORM_SIZE:
$error = “The uploaded file exceeds the 85kb”;
break;
case UPLOAD_ERR_NO_FILE:
$error = “No file was uploaded”;
break;
default:
$error = “”;
}
//test
$fname = $_FILES[‘file’][‘name’][$fileid];
$dest = $upload_path.$fname;
$tmpfile = $_FILES[‘file’][‘tmp_name’][$fileid];
if ($tmpfile)
{
$info = getimagesize($tmpfile);
$ftype = $info[‘mime’];
if ($ftype != “image/gif” && $ftype != “image/jpeg”)
{
$error = “File type not supported”;
$problem = TRUE;
}
else
{
if (file_exists($dest))
{
$error = “File already exists. (“.$dest.”)”;
$problem = TRUE;
}
else
{
copy ($tmpfile,$dest);
$problem = FALSE;
}
}
}
return array($problem, $error);
}
?>