Jump to content

Recommended Posts

i have a back end part to my site so someone can easily update the products.  i want it to be able to save pictures from my desktop in my website images folder

 

ithought it worked but it definitely doesnt  i  am pretty sure its because the images arent saving right

 

here is my code i took it from a tutorial and based it to needs

 

<?php require_once("includes/session.php"); ?>
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php confirm_logged_in(); 
//echo "<pre>";
//print_r($_FILES);
//echo "</pre>";
$target_path = "images\ ".$_FILES['uploadedfile']['name'];
move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path);
$image_source = mysql_prep($_FILES['uploadedfile']['name']);
$id = $_GET['prod'];
$query = "UPDATE products SET 
						image_source = '$image_source'
					WHERE product_id = $id";
//print $query;
			$result = mysql_query($query);
			if (mysql_affected_rows() == 1) {
				redirect_to("edit_product.php");
			} else {
				// Failed
				$message = "The product update failed.";
				$message .= "<br />". mysql_error();
			}?>

 

does anyone see anything i am doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/115632-solved-file-uploading/
Share on other sites

"Aren't saving right"

 

 

what are they pictures of mickey mouse when you uploaded donald duck? Are they just not there? Have they moved folder? Be specific. DO you have the include pages? Also, if its a tutorial, then it 99% works. Make sure you did everything exact. If it still doesn't work, then its a problem with th tutorial code. Contact the author of it if its a genuine problem.

 

Upon reading your code...what the hell??? this has nothing to with image UPLOADING....please rephrase your question.

i kind of assumed that

 

"$target_path = "images/ ".$_FILES['uploadedfile']['name'];

move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path);

$image_source = mysql_prep($_FILES['uploadedfile']['name']);

"

 

was moving a file, is it not?

 

my code  (i thought) was saving the file in my images folder and then saving the name in my database is that not what this is doing with the uploader? if not what is it doing?

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.