Jump to content

Recommended Posts

I am using the uploader.php that is in a tutorial to upload pictures to my site. but when i upload them everything is working fine except that the pictures are not being saved in my images folder(everything being, the name is saving in the database and being called correctly)

 

maybe another set of eyes could help me spot the problem, here is my code

 

<?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['page'];
$query = "UPDATE pages SET
                            image_source = '$image_source'
                        WHERE id = $id";

                $result = mysql_query($query);
                if (mysql_affected_rows() == 1) {
                    redirect_to("edit_page.php");
                } else {
                    // Failed
                    $message = "The product update failed.";
                    $message .= "<br />". mysql_error();
                    echo $message;
                }?>

here is where the actualy information is coming from

 

<form enctype="multipart/form-data" action="uploader.php?page=<?php echo $sel_page['id']; ?>" method="POST">

<input type="hidden" name="MAX_FILE_SIZE" value="100000" />

Choose a file to upload: <input name="uploadedfile" type="file" value= "<?php print $sel_page['image_source']; ?>"/>

<input type="submit" value="Upload File" />

</form>

Link to comment
https://forums.phpfreaks.com/topic/117032-help-wiht-file-upload/
Share on other sites

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.