php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2008

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 14.11.2007, 20:00  
Neuer Benutzer
 
Registriert seit: 14.11.2007
Beiträge: 1
Viktor befindet sich auf einem aufstrebenden Ast
Standard Bildupload HILFE!!!

Hallo,

ich habe es soweit geschaft das die Datei hochgeladen wird!

Was muss ich hinzufügen das die datei in die datenbank Tabelle: "address_book", Feld: "Bild" eingetragen wird und zusätzlich zu customers_id auch noch die adressbuch id als dateiname gespeichrt wird? Also derzeit ist es so:

customers_id_dateiname.jpg

und so will ich es:
customers_id_address_book_id_dateiname.jpg

**************
Formular:
*************
PHP-Code:
 <td align="center" class="main" colspan="0">
 <
script TYPE="text/javascript" LANGUAGE="JavaScript">
 <!--
 function 
upload(){
 
window.open('upload.php''_blank''toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizeble=no, width=300, height=200');
 return;
 }
 
 
// -->
 
</SCRIPT>
 <A HREF="javascript:upload();"><IMG SRC="images/icons/upload.gif"></A>
 </td>
 </TR> 

******************
upload.php:
*****************
PHP-Code:
 <?php
 
/*
 upload.php file upload for logo files
 Donnerstag 5.2.2004 09:11
 */
 
 
require('includes/application_top.php');
 
  if (!
tep_session_is_registered('customer_id')) {
  echo 
"Upload not allowed!";
  exit;
 }
 
  require(
DIR_WS_LANGUAGES $language '/upload.php');
 
$max_size=2220480
 
$upload_path='/home/www/htdocs/upload/'
 
?>
 
 
 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html <?php echo HTML_PARAMS?>>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>">
 <title><?php echo UPLOAD_TITLE?></title>
 <link rel="stylesheet" type="text/css" href="stylesheet.css">
 </head>
 <body marginwidth="0" marginheight="0" topmargin="5" bottommargin="0" leftmargin="5" rightmargin="5">
 
 
 <?php
 
 
echo '<p class="main">';
 
printf(UPLOAD_TEXT,$max_size);
 
 if(!isset(
$HTTP_POST_FILES['toProcess'])){
  
//Formular anzeigen
  
?>
  <FORM enctype="multipart/form-data" action="<?php
  $PHP_SELF
?>" method="POST">
  <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size;?>">
  <TABLE border="0" cellspacing="0" cellpadding="5">
  <TR class="infoBox">
   <TD class="infoBoxContents"><?php echo UPLOAD_FILE_NAME;?></TD>
   <TD class="infoBoxContents"><input name="toProcess" type="file"></TD>
  </TR>
 <TR class="infoBox"><TD class="infoBoxContents" colspan="2" align="center"><input type="submit" value="Upload"></TD></TR>
  </TABLE>
  
  </FORM>
  <?php
 
}else{
  
$file tep_get_uploaded_file('toProcess');
  
$okeregi('(.*\.gif$|.*\.jpg$)',$file['name']);
    if (
$ok && is_uploaded_file($file['tmp_name']) && $file['size']< $max_size) {
   
$rec_query=tep_db_query('select * from ' TABLE_ADDRESS_BOOK ' where customers_id='.(int)$customer_id);
   
$rectep_db_fetch_array($rec_query);
   
$new_file=$upload_path.$customer_id.'_'.$file['name'];
   
move_uploaded_file($file['tmp_name'],$new_file);
   
$rc=exec('chmod 0660 '.$new_file);
   echo 
'<BR><BR>'.UPLOAD_SUCCESS;
 
   }else{
   echo 
'<BR><BR>'.UPLOAD_ERROR;
  }
 }
 
 
?>
 </p>
 
 </BODY>
 </HTML>

DANKE
Viktor ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Erledigt] Hilfe: Projektabreit Informatik und Technik bitte helft uns. Off-Topic Diskussionen 31 05.04.2006 18:25
Problem beim Bildupload/ Thumbnailerstellen imported_FlasH PHP Tipps 2006 2 02.03.2006 08:12
PHP <--> MySQL | Brauche Hilfe ahnungsloser Datenbanken 18 16.02.2006 21:49
[Erledigt] HILFE HILFE HILFE mysqladmin.exe fehlt Datenbanken 7 20.12.2005 14:00
[Erledigt] Hilfe mit encoded php-Files PHP-Fortgeschrittene 9 02.11.2005 16:16
HILFE ! Brauche ganz dringend hilfe! PHP Tipps 2005-2 2 10.10.2005 23:08
Bitte um schnelle hilfe TaStEn PHP Tipps 2005-2 1 03.09.2005 20:46
[Erledigt] Probleme mit Linkverfolgung !!! HILFE !!! PHP-Fortgeschrittene 5 20.07.2005 18:24
[Erledigt] Hilfe bei Formular für Datenerhebung benötigt PHP Tipps 2005-2 3 16.07.2005 10:43
[Erledigt] VARIABLEN WERDEN NICHT RICHTIG VERARBEITET!!!! HILFE PHP Tipps 2005-2 6 02.07.2005 18:32
php Neuling braucht mal schnell hilfe !! PHP Tipps 2005 5 05.03.2005 13:30
[Erledigt] HILFE PHP Tipps 2004-2 1 16.12.2004 20:49
PHP, Frontpage -----> HILFE!!!! HTML, Usability und Barrierefreiheit 4 30.11.2004 15:00
Suche -dringend- Hilfe zu einem Smily Mod! <- HiLFE - :-) PHP Tipps 2004-2 0 07.11.2004 13:50
hilfe, hilfe, wie mach ich mir einen localhost? PHP Tipps 2004 4 24.09.2004 22:49


Alle Zeitangaben in WEZ +2. Es ist jetzt 19:01 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum