jera Posted March 9, 2007 Share Posted March 9, 2007 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 More sharing options...
jera Posted March 12, 2007 Author Share Posted March 12, 2007 noboddy? Link to comment https://forums.phpfreaks.com/topic/41955-image-import-to-map/#findComment-205315 Share on other sites More sharing options...
jera Posted March 13, 2007 Author Share Posted March 13, 2007 ...:( Link to comment https://forums.phpfreaks.com/topic/41955-image-import-to-map/#findComment-206063 Share on other sites More sharing options...
only one Posted March 13, 2007 Share Posted March 13, 2007 jetje man dat is en helebool troop (sorry voor mijn slechte nederlands) Link to comment https://forums.phpfreaks.com/topic/41955-image-import-to-map/#findComment-206065 Share on other sites More sharing options...
only one Posted March 13, 2007 Share Posted March 13, 2007 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 More sharing options...
jera Posted March 13, 2007 Author Share Posted March 13, 2007 tnks ga hem testen. Ik ben pas net met php begonne dus vond het al heel wat dat het werkte Werkt niet, In zo verre.... Ik kan nog geen map kiezen waar het plaatje in komt Ik wil echt een map selecteren in de website.... En nu gooit hij het in 1 map... Link to comment https://forums.phpfreaks.com/topic/41955-image-import-to-map/#findComment-206069 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.