Jump to content

Help With Move_Uploaded_File


Recommended Posts

<p><p>HI I am having trouble using this function, I am hosting my website on 1and1 with the following php.ini:

 

 

register_globals = 0
allow_url_fopen = 1
session.bug_compat_warn = 0
memory_limit = 128M
max_execution_time=3600
post_max_size = 128M
upload_max_filesize= 128M
upload_tmp_dir = '/temp'

 

And this is the code used to upload the file:

 


<?php

include ('connection.php');
session_start(); 
$target = "Images/"; 
$pic=$HTTP_POST_FILES['previewImage']['tmp_name'];
$destination='/Images';
$date = date('d-m-Y');

$postarticle = "INSERT INTO articles VALUES (NULL,'$_POST[title]',CURDATE(), '{$_SESSION['ID']}','Images/$_POST[previewImage]', '$_POST[preview]', '$_POST[video]', '$_POST[content]', '$_POST[additionalInformation]', '$_POST[type]')";
if (mysql_query($postarticle,$conn)){
move_uploaded_file($pic,$destination.$HTTP_POST_FILES['previewImage']['name']);
header("Location: index.php");
}
else
{
header("Location: {$_SERVER['HTTP_REFERER']}");
}
?>

Edited by Error404PageNotFound
Link to comment
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.