Jump to content

image import to map


jera

Recommended Posts

Ik have a script that let users upload images to the database.

Oke noprob. But One of our custumers got image galaries that he want to edit just bij uploading the files.

Ik manged to make a page that shows the images of 1 map.

But the upload file doesn't support the to select a map.

 

How can i fix this? Here is my upload script

(Sorry for my bad english)

 

<table width="100%" cellspacing="0" cellpadding="0"> 
<form action="" enctype="multipart/form-data" method="post"> 
<input type="hidden" name="upload"> 
<tr> 
<td align="center" bgcolor="#FFFFFF"> 
<? 
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['upload'])) { 

if (empty($_FILES['foto']['name']) || !eregi('\.(gif|jpg|jpeg|png|psd|bmp|xls|doc|txt|pdf)$', $_FILES['foto']['name']) || file_exists($_FILES['foto']['name'])) { 
$msg = '<font color="#FF0000">de foto kan niet geüpload worden.</font><br><br>'; 
} else { 
if (move_uploaded_file($_FILES['foto']['tmp_name'], $_FILES['foto']['name'])) { 
$msg = '<font color=red><B>De afbeelding is geüpload.</b></font><br>'; 
} else { 
$msg = '<font color="#FF0000">de foto kan niet geüpload worden.</font><br><br>'; 
} 
} 

echo $msg; 
} 
?> 
<B>Plaatje uploaden: </b>
<input type="file" name="foto" size="30">
<input type="submit" value="upload"></td> 
</tr> 
</form> 
<tr> 
<td style="padding:20px;" align="center"> 
<? 
$fotos = array(); 

$handle = opendir('../img'); 

while (false !== ($foto = readdir($handle))) { 
if (eregi('\.(gif|jpg|png|psd|bmp|pdf)$', $foto)) { 
$fotos[] = $foto; 
} 
} 

closedir($handle); 

sort($fotos); 
reset($fotos); 

if (isset($_GET['foto']) && file_exists($_GET['foto'])) { 

if (isset($_GET['id']) && $_GET['id'] != 0) { $newid = $_GET['id'] - 1; echo '<a href="index.php?foto='.$fotos[$newid].'&id='.$newid.'">vorige</a> | '; } 
echo '<a href="index.php">overzicht</a>'; 
$fotocount = count($fotos) - 1; 
if (isset($_GET['id']) && $_GET['id'] != $fotocount) { $newid = $_GET['id'] + 1; echo ' | <a href="index.php?foto='.$fotos[$newid].'&id='.$newid.'">volgende</a>'; } 
echo '<br><br>'; 



} else { 

$count = 1; 
foreach ($fotos as $id => $value) { 
if ($count == 6) { $br = '<br>'; } else { $br = ' '; } 
echo '<a href="index.php?foto='.$value.'&id='.$id.'"></a>'.$br; 
if ($count == 6) { $count = 1; } else { $count ++; } 
} 

} 
?>

Link to comment
https://forums.phpfreaks.com/topic/41955-image-import-to-map/
Share on other sites

my old code... might still have some of my old stuff in it

<?php
session_start();

echo('Upload image<br><br>');


$path = "uploads/";



if (!isset($HTTP_POST_FILES['userfile'])){ echo "
<FORM ENCTYPE=multipart/form-data ACTION=?page=Upload METHOD=POST>

  <p>The file:<br>
    <INPUT TYPE=file NAME=userfile style='border: 1px solid #222222; background-color: #111111; color: #888888'>
  </p>
  Name: <br><input type=text name=name size=25 style='border: 1px solid #222222; background-color: #111111; color: #888888'>
  <p>
  Descritption:<br> <textarea cols=25 name=description style='border: 1px solid #222222; background-color: #111111; color: #888888'></textarea>
  </p>

  <p>
    <INPUT TYPE=submit VALUE=Upload style='border: 1px solid #222222; background-color: #111111; color: #888888'>
  </p>
</FORM>
"; }else{
if($name==NULL){ echo "<font color=red>Error!</font>: Please give you image a name<br><FORM ENCTYPE=multipart/form-data ACTION=?page=Upload METHOD=POST>

  <p>The file:<br>
    <INPUT TYPE=file NAME=userfile style='border: 1px solid #222222; background-color: #111111; color: #888888'>
  </p>
  Name: <br><input type=text name=name size=25 style='border: 1px solid #222222; background-color: #111111; color: #888888'>
  <p>
  Descritption:<br> <textarea cols=25' name=description style='border: 1px solid #222222; background-color: #111111; color: #888888'></textarea>
  </p>

  <p>
    <INPUT TYPE=submit VALUE=Upload style='border: 1px solid #222222; background-color: #111111; color: #888888'>
  </p>
</FORM>"; }else{
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png")) {
if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) { echo "The file already exists, try calling your file a different name.<br>"; }else{
$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path .
$HTTP_POST_FILES['userfile']['name']);
if (!$res) { echo "upload failed!<br>"; exit; } else { echo "upload sucessful<br><br>"; }
echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."<br>";
echo "File Path: <a href=uploads/".$HTTP_POST_FILES['userfile']['name']." TARGET=_BLANK>uploads/".$HTTP_POST_FILES['userfile']['name']."</a><br>";
echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes<br>";
echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."<br>";
echo "<img src=uploads/".$HTTP_POST_FILES['userfile']['name']."><br>";

}}}}}


?>

Link to comment
https://forums.phpfreaks.com/topic/41955-image-import-to-map/#findComment-206067
Share on other sites

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.