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']}");
}
?>

Link to comment
https://forums.phpfreaks.com/topic/269179-help-with-move_uploaded_file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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