Jump to content
php.lv forumi

upload.php


ziedinjsh

Recommended Posts

upload.php

<?php
session_start();

  $destination_path = "../avatars/";

  $result = 0;

  $user_photo = $destination_path . basename( $_FILES['avatar']['name']);

  $avatar = "UPDATE users SET user_photo='$user_photo' WHERE user_email='".$_SESSION['user_email']."'";
  if(@move_uploaded_file($_FILES['avatar']['tmp_name'], $user_photo)) {
     $result = 1;
  }

  sleep(1);
?>

<script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?>);</script>   

 

Bildi folderā augšupielādē, bet iekš mysql neieliek bildes nosaukumu! Kas par vainu!?

Link to comment
Share on other sites

labi. tagad peivieno datubāzei, bet tagad vairs neuploado bildi! kapēc tā!?\

 

<?php
session_start();
include ("dbase.php");

  $destination_path = "../avatars/";

  $result = 0;

  $user_photo = $destination_path . basename( $_FILES['avatar']['name']);   $user_photo = ($_FILES['avatar']['name']);


  $mysql = mysql_query("UPDATE users SET user_photo='$user_photo' WHERE user_email='".$_SESSION['user_email']."'");
  if(@move_uploaded_file($_FILES['avatar']['tmp_name'], $photo)) {
     $result = 1;
  }

  sleep(1);
?>

<script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?>);</script>   

Link to comment
Share on other sites

briedi, tik traki ir ?

nu ja tu iedod definētu mainīgo ar kveriju, tad to vaig izpildīt!

t.i -

mysql_query($mainigais) or die(mysql_error())

Šitas strādā - "STABILI UN DROŠI!"

 

http://php.lv/f/user/3549-ziedinjsh/page__tab__topics

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...